Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The declared namespace Foo does not match src actually never matches with my projects. #76

Open
pounard opened this issue Jul 3, 2020 · 5 comments
Labels

Comments

@pounard
Copy link

pounard commented Jul 3, 2020

Since 2020-06 version, the validation warning/notice such as The declared namespace "App\Controller\Gestion" does not match the expected namespace "src\Controller\Gestion" is very annoying.

It's an extremely powerful feature and I would love to use it, yet it seems you cannot tell PDT which namespace to match in which folder (I might be wrong). I don't know how it deduces it, but it actually never matches real PSR-4 or PSR-0 configuration from my composer.json file, so considers that ALL my PHP files are at an invalid location.

Version is:

Eclipse IDE for PHP Developers (includes Incubating components)
Version: 2020-06 (4.16.0)
Build id: 20200615-1200

I have quite a few addons installed, including PDT Extensions, I in that regard, it might be one of them messing up, but I'm not sure.

  • OS: Running ArchLinux, uname output: Linux guinevere 5.7.6-arch1-1 #1 SMP PREEMPT Thu, 25 Jun 2020 00:14:47 +0000 x86_64 GNU/Linux
@pounard pounard added the bug label Jul 3, 2020
@zulus
Copy link
Member

zulus commented Jul 10, 2020

If you enable composer support for your project (right click -> configure -> add composer support) it should read it correctly.

But be careful, by default composer will try to rewrite your buildpath

@pounard
Copy link
Author

pounard commented Jul 10, 2020

Yes indeed, it works now, thanks ! Still I'd add a few thoughts here:

  • Why isn't the composer support automatically enabled if a composer.json file is found?
  • A lot of projects I'm working on, composer.json file is in a sub-directory (i.e. /app/composer.json for example) will it still work?
  • It should probably be configurable in the project properties when composer.json file is absent or composer support isn't enabled?
  • The feature should probably be in a disabled state until configured.

@zulus
Copy link
Member

zulus commented Jul 10, 2020

Composer was separate community project that was transferred to us couple years ago. Some auto-discovery works during import/create project but not always. There is a plan to finally build one simple project creation/update wizard but after I finish new model without some DLTK limitations.

As for now composer support have couple limitations:

  1. composer.json have to be in root directory
  2. composer editor always open with name as project, so if you open something from vendor you might be confused
  3. problems with synchronisation between buildpath update / workspace refresh / composer.json / composer.lock
  4. have own php launch implementation that sometimes giving me crazy

As for now I personally use it mostly for correct "new class" , "validation" and buildpath refresh. I personally not use our powerful composer.json editor in my daily work ;)

Any ideas welcome, but for now we have only 2 committers and a lot of work to do.

@pounard
Copy link
Author

pounard commented Jul 11, 2020

Any ideas welcome, but for now we have only 2 committers and a lot of work to do.

Yeah I can imagine that 2 is often not enough ! Long time I didn't wrote any Java code, 10 years actually, maybe someday I'll try. I'm impressed with PDT quality knowing that you're not much people maintaining it, thanks for all you do.

@rtwent
Copy link

rtwent commented Nov 26, 2023

If this still not work and You project has such structure

|- smt
|- code
  |-src
    |-Entity
    |-etc...
  |-composer.json
|- docker

Right click on code folder in project explorer tab and select: Use as source folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants