R
R
Rain Summers2015-03-23 20:37:05
IDE
Rain Summers, 2015-03-23 20:37:05

How to set up auto-rename of namespaces in PhpStorm when moving files?

Hi, anyone!
There is the following conditional project structure.
The root folder is "project", it has 2 folders with classes 'classes1' and 'classes2', and the class 'myClass.php' in the folder 'classes1' .
26ef8107414b48969f168cbd208d6daa.png

// myClass.php

namespace project\classes1;

class MyClass{
}

How to set up an IDE or which plug-in to install so that when a file is moved, its namespace automatically changes according to the new location?
Those. so that when moved to 'classes2', the new namespace becomes like this.
namespace project\classes2;

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Osher, 2015-03-24
@summer_rain

As far as I remember PhpStorm has such a thing as PSR Namespace Roots .
Perhaps the correct configuration will automatically do everything.

G
gaparchi, 2019-01-10
@gaparchi

In the code editor, put the cursor on the class name and press F6, change the namespace to whatever you want and press refactor.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question