set namespace on all files in folder and sub folders

I have a folder in my project with sub folders. The PHP classes in these folders do not have namespacing and there about 750 class files.

Is there a way in phpstorm to set the namespace on all classes in a folder and sub folder?  I really do not want to go through each file manually.

 

 

0
1 comment

No, unfortunately, we don't have any kind of 'missing namespace declaration' inspection so that you could batch-apply it. Regex also wouldn't help because I suppose that we need to parse the directory structure to assign correct namespaces.

I think the easiest way would be writing a simple PHP script that would parse the directory and insert the namespace, it definitely should take less time than manual addition of the declaration to 750 files.

0

Please sign in to leave a comment.