Refactor class into new/different namespace?

how can I refactor a class into a new namespace or, basically change the namespace? Note that I'm not talking about renaming a namespace.

Refactor form:
namespace foo;
class bar {
namespace what\ever;
class bar {

Note that my real usage deals with more complex hierarchies, etc.

With refactoring I mean:
- move file to a new location (directory)
- adjust all references

All I can find is rename classses and namespaces or move files; but e.g. moving files does not automatically adjust the namespace, etc.

My code is PSR-4 compliant.


Using PhpStorm 8.0.1
Build #PS-138.2001, built on September 18, 2014
JRE: 1.6.0_65-b14-462-11M4609 x86_64
JVM: Java HotSpot(TM) 64-Bit Server VM by Apple Inc.

Comment actions Permalink

Hi there,

Sure -- use "Refactor | Move..." on class.

Comment actions Permalink

Ah, thanks; hits me like a brick. The subtles between rename/move (F6, SHIFT-F6) and whether using this on a class or file ... thank you, I got confused ;)


Please sign in to leave a comment.