PhpStorm tells me "Namespace name does not match PSR 0 / PSR 4 project structure"

I am using Laravel 5.0 and everything works fine.

However, I keep getting these warning messages. I've looked at the JetBrains docs, but I'm left a little hazy on what to do about it.

As such, I am concerned that if I allow PhpStorm to automatically run the "PSR0 Namespace Root Discovery" then it might break my code / project.

Not sure what's going on, what should I do?


source to share

2 answers

The roots of the PSR-4 namespace can indicate the prefix to be configured.

Here's the process:

  • Find the root of your namespace eg src

  • right click Mark directory as root source.
  • Menu → File → Settings → Directories.
  • Press p ^ next to the root of sources.
  • Enter the namespace prefix.

See PHPStorm for configuring PHP namespaces



PSR-0 is just a convention for structuring your PHP projects. When PHPStorm asks to auto-detect "Discovery of PSR0 Namespace Roots", it prompts you to check which classes will be auto-loaded so that it can auto-complete correctly when you write your code.

This does not affect your code, but it can improve the coding quality.



All Articles