Issue
I have a bunch of classes in src/Controller, src/Entity, src/Form etc. For each of them Netbeans tells me that "namespace declaration name doesn't correspond to current directory structure". My namespaces:
namespace App\Controller;
namespace App\Entity;
namespace App\Form;
Is it Symfony or Netbeans issue? Is it something to be worried about?
Solution
There is no problem with Symfony, and there is nothing to be worried about. The contradiction is as follow:
Symfony4 structure is based in namespaces but still is under src/
directory the default namespace is App
and netbeans expects your namespace to be something like src/Controller/MyController
or any other pattern that matches with the folder structure.
Also the standard used by Symfony to autoload files is psr-4, to check this you may take a look at composer.json or under composer installation directory.
Try to check the netbeans configuration under Tools->Options->Editor->Hints->PHP->PSR and select the proper autoload configuration
You can check the diferences of psr-0 and psr-4 to understand why netbeans is throwing those warnings.
Hope it helps!
Answered By - Juan I. Morales Pestana
Answer Checked By - Timothy Miller (JavaFixing Admin)