Moving namespaced classes with PSR-4 autoloader

Answered

Hi,

I am using the PSR-4 autoloader folder structure in my project. If I move a class, ie. `EntityRepository` with namespace `vendor\infrastructure` from the folder `infrastructure` to `infrastructure/entity`, I would like the namespace of the class to be automatically refactored to `vendor\infrastructure\entity`. Is that possible?

Thanks.

5 comments

Hi there,

Yes, invoke "Refactor | Move" action on a class (open a file with that class, place caret on the class name, invoke aforementioned action)

1

You can do similar if you invoke Refactor > Move directly on a class in an Editor:

1

Nice. Any possibility to have this automated when I simply drag&drop a file in my project tree from one folder to the other?

0

Please sign in to leave a comment.