Change Namespace by changing Directory name in Sub-Directory

So I have this laravel application where we have split up our packages/modules to a dedicated folder in the root directory (called modules). Here is the file structure:

- app/
- modules/
    - package-foo/
        - DirectoryToChange/
            - ClassToRefactor

So I have setup the package-foo directory in the configuration to use the namespace Foo/Bar/ ... But when I try to rename the DirectoryToChange folder that is representing part of the namespace (as in PSR0/PSR4) the namespaces and use statements of the ClassToRefactor class are not updated.

For the App/ Namespace everything is working as expected. I change some directory and all namespaces and use statements are updated correctly.

I have really tried everything thing that I could come up with but with no luck. I hope you, the PhpStorm Pros can help me ;-) Thank you!

0

There are two requirements:

1. You need to have the PSR-0/4 structure described as source roots at Settings | Directories, so that PhpStorm knew how namespaces correspond to folders. If this structure is described in composer.json already, PhpStorm can reuse that.

2. You need to invoke rename not against the directory but against the namespace, like, in code itself.

https://recordit.co/scDrQMTyR8

0

请先登录再写评论。