Search code examples
phpphpstorm

Is it possible in PhpStorm to automatically change namespaces and uses according to a changed project folder structure?


I've got to a point where I need to change my project folder structure. When I'll do so, some namespaces will change and after, some use statements will need to be different.

So I'm wondering if there is a way (maybe PhpStorm has some functionality for it) to handle changed namespaces and use statements automatically?


Solution

  • There is no feature like the one you ask for, for as far as I'm aware. You can however use the following method for the use statements:

    Use CTRL + SHIFT + R (Replace in path) to replace the old use statements throughout your whole project with the updated statement.

    This just leaves renaming the namespaces, which you'll have to do yourself.