Refactor class into new/different namespace?

Hello,
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:
{code}
namespace foo;
class bar {
}
{code}
into
{code}
namespace what\ever;
class bar {
}
{code}

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.

thanks

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.

2 comments
Comment actions Permalink

Hi there,

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

3
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 ;)

1

Please sign in to leave a comment.