3

The folder for my PHP Eclipse project has a folder "src/" in the root path and inside it is a tree of the PHP files.

I have the following warning for all of my php files:

The declared namespace "" does not match the expected namespace

The issue is that the validator is expecting all namespaces to start with the top level "src/" folder when this is the path of where all of the source code of the project begins.

Eclipse Java projects allow specifying where the source folder is but I don't see an option for this with the PHP project.

Am I forced to place my source tree starting at the project root to satisfy the validator?

I am using Eclipse 2020-12 (4.18).

howlger
  • 31,050
  • 11
  • 59
  • 99
Zhro
  • 2,546
  • 2
  • 29
  • 39
  • I define it in the composer.json, not sure how to do it outside of composer though. – Nigel Ren Mar 08 '21 at 11:44
  • I think Eclipse doesn't support defining namespace root but it always blindly assumes that project root is the same as namespace root. The best solution to this problem is just to disable this warning: https://stackoverflow.com/a/62518712/334451 – Mikko Rantalainen Aug 16 '21 at 09:42

0 Answers0