Move Class (mass) and namespaces

Hello.

I trying to divide my app to several applications like console, backend, frontend and dedicate common directory for all of them.

As i remember it was available to move one or multiple files at the same time to another directory (i.e. via drag'n'drop) and PhpStorm automatically adjusts it namespaces.

But now it isn't working.

Refactor | Move dialog just moves file to another location (but PhpStorm trying to find occurrences before move file). I Found solution: open file, put pointer on the class name and do the same action, then opens Move Class dialog.

But this solution has some issues:

  1. It is impossible to open all files and do class refactor for each of them, one by one, it will spend too much time.
  2. After i try to do this with few files i found that PhpStorm excludes some occurrences. I do that for User class, and after refactor i find in directory for app\models\User and found 228 occurrences (2 occurrences for Profile model). Yes, PhpStorm refactored some files, most of them, but i should verify each class after refactor. it's discourages me.

I have found Move Namespace Dialog in documentation, but i can not execute it in PhpStorm, as i described Refactor | Move opens just move file to another location dialog.
Link to documentation: https://www.jetbrains.com/help/phpstorm/2017.1/move-namespace-dialog.html

How can i do this kind of refactor not in manual mode?

Maybe is there more suitable way to achieve it? 

I tried in PhpStorm 2017.1 and 2017.2 EAP 172.2273.9 and 172.2465.7. Mac OS Sierra. Same result.

 

Thanks,
Mikhail.

 

5 comments
Comment actions Permalink

Hi there,

>I have found Move Namespace Dialog in documentation, but i can not execute it in PhpStorm, as i described Refactor | Move opens just move file to another location dialog.

Refactor actions are context dependant.

You have to do similar to what you did for the Class -- place caret on the namespace and invoke "Refactor | Move"

 

3
Comment actions Permalink
  1. It is impossible to open all files and do class refactor for each of them, one by one, it will spend too much time.

Question is actual.

0
Comment actions Permalink

Alexander, comment, posted by Andriy helped me.

0
Comment actions Permalink

please add this feature. Even why we have to  place caret on the name of the Class ? Wouldn't be easy to just drag & drop files ? 

0

Please sign in to leave a comment.