I have an issue with my PhpStorm using incorrect namespaces when creating a new class.
Example:
I have a module named Booking
. Inside Booking
I want to create a controller called StatusController
. The directory the controller class will be created in is Booking/src/Controller, and after being created it's namespace should be Booking\Controller
, but my IDE is making it Booking\src\Controller
The Booking
module is located inside a module
directory in my project, and the module
directory has been set as a Source Folder for my project:
Could anyone please help me find what setting I have to change to make namespaces auto generate as Booking\Controller
instead of Booking\src\Controller
?
Open Settings --> Directories;
Choose your ../module/Booking/src
folder;
Right-click --> Mark as Sources;
On the right panel, you should see your folder (blue). Click on P
with little arrow - Edit Root Properties
. In input field Package prefix
put as Booking
;
Apply/Ok all windows
On screenshot, I have different paths, but you should get the gist.
Now in New Class
dialog window in the field Namespace
you can choose namespace between 'with src' and 'without'.