Is this namespacing issue my problem or is it an IDE problem?

I have a namespacing notification on the PhpStorm IDE and I can’t see how to resolve it.

IDE

  • PhpStorm 2023.1

Structure

I have a class amongst various other classes by other vendors, my class sits in this folder:

/home/classes/vendor/namespaceOuter/namespaceInner/subnamespace

The autoloader.php file sits in /home/classes/

My class file sits inside the above folder, and is ClassFile.php. Within, this has the namespace set out as here:

<?php
Namespace namespaceOuternamespaceInnersubnamespaceClassFile;

use exception;
use PDOexception;

class ClassFile {
      ... 
}

Problem

The PhpStorm IDE tells me:

Namespace name doesn’t match the PSR-0/PSR-4 project structure

NOT a problem

  • The autoloader works perfectly.
  • The class and its children and peers all work perfectly on the live website, the issue seems purely with the IDE informing me we’re not following the PSR-0/PSR-4 .

Attempted Solutions

  • I have tried to change the namespace to make it call from root (namespaceOuternamespaceInnersubnamespaceClassFile;) within the Class file but this doesn’t remove the notification.

  • I have tried to use the suggested fix by the IDE which in fact makes a bunch of new child folders in the current class’ folder (/home/classes/vendor/namespaceOuter/namespaceInner/subnamespace/namespaceOuter/namespaceInner/subnamespace/ClassFile.php) which is clearly impractical and wrong.

  • Other established classes (such as PHPMailer) within the vendor/ folder do not have the same notice on their class files.

Reading

I have read the PHP Namespacing documentation as well as the PSR-4 documentation which includes this example:

Fully Qualified Class Name Namespace Prefix Base Directory Resulting File Path
SymfonyCoreRequest SymfonyCore ./vendor/Symfony/Core/ ./vendor/Symfony/Core/Request.php

While this IS NOT a Symfony project, the inconsistency between qualified namespace and file path implies this is not an issue.

Fully Qualified Class Name Namespace Prefix Base Directory Resulting File Path
namespaceOuternamespaceInnersubnamespaceClassFile.php namespaceOuternamespaceInnersubnamespace classes/vendor/ ???

Question

Is this namespacing incorrect somehow or is there an issue with the PHPStorm IDE suggestion (I believe so) — if so, how can I check/ update / confirm / fix this?

Thanks