Moving files within a project and includes

Hi,
I'm assuming that PHPStorm will rename my include/require references if I move the file associated with these to another directory. Is this possible. If so how do I make it work? Thanx.

7 comments
Comment actions Permalink

Hi Steve,

Yes, as long as PhpStorm is able to recognise it  correctly (that calling file is using this include file etc).

Plus, when you move existing file in PhpStorm (using mouse or Refactor | Move), you will see dialog box (where it will ask for new name etc) -- there is "Search for references" field.

0
Comment actions Permalink

Hi,
I'm assuming it's not working for me because I am using files with names like myfile.inc.php ?

0
Comment actions Permalink

It ends with .php .. so it should.

Try making some simple screencast where you invoke "Refactor | Move" on file and it does not work. Start with something simple, when files are in the same folder and you move included one into subfolder. See if it works there first. Maybe you will spot the pattern/reason on why it does not work for you.

0
Comment actions Permalink

So I take it if I have a file named, say, header.inc.php and move that file with refactoring to another folder and the file is referenced as an include in other files this will do nothing? It does nothing on my install. Does it only refactor if you move the file that is referencing the source file?

0
Comment actions Permalink

I just checked again: Rename works fine (file got renamed in referenced file), but Move did nothing.

Apparently there is a ticket for this issue (over 1 year old) : http://youtrack.jetbrains.com/issue/WI-4439

Don't know why I though it worked for me in the past -- posibly I confused it with Rename (as I very rarely moving include files -- only in old projects that do not see much activity -- I'm using auto-loading approach now).

Sorry for confusion.

0
Comment actions Permalink

I'm just moving around a lot of files and the fact that this feature isn't working is a big nuisance. Any thoughts on whether it will be fixed anytime soon?

0
Comment actions Permalink

Well ... ticket tells that it is planned for v5

0

Please sign in to leave a comment.