In-place Rename Refactoring in PhpStorm 9.5

PhpStorm 9.5 has an amazing innovation in its refactoring engine. Now, when you need to rename a variable, parameter, class, method, constant or goto label, you can do it in-place, right in the editor pane.

To invoke the new in-place rename, simply place the cursor over the item you want to rename and select Rename… from the Refactor menu (or use the keyboard shortcut Shift+F6).

Instead of the usual dialog, you’ll see the item you want to rename highlighted in the editor pane. You can now alter the name of the variable, parameter or method you are refactoring in place, and press Enter once you’re finished.

Inline Rename in PHPStorm 9.5

If this is a public method, class name, or anything else that can be referenced from outside of this file, PhpStorm will then search the rest of the project for usages of this edited item. If it finds any, the Refactoring Preview pane will open, allowing you to preview and then commit the changes across the project.

Try the new in-place rename yourself, and let us know what you think.

Develop with pleasure!
– JetBrains PhpStorm Team

About Gary Hockin

Gary Hockin has been creating code to power web applications for 15 years, the last three of them at an extraordinary level. He is handsome, talented, funny and articulate, and also extremely modest. Gary is a valued contributor to Zend Framework 2 and is a member of the community review team. He's married and has two wonderful children, and when he's not coding, writing about code, speaking about code or reading about code, he can usually be found in the pub playing pool.
This entry was posted in Cool Feature and tagged , , , . Bookmark the permalink.
  • Funivan

    This is amazing feature. The most used refactoring techinck is “Renaming variable” in-place rename improve my productivity a lot.

    • Vladislav Rastrusny

      Wnat exactly does it improve? :) It looks like the amount of keypresses and mouse clicks remains the same.

      • Funivan

        Time is money.
        Without this feature you need to press a lot of keys and spend much more time. Also in-place rename suggest me nice variables names that i can use immediately.

        • Vladislav Rastrusny

          Can you please elaborate “a lot of keys”? I think the amount of keypresses is the same – Shift-F6. After that you can either edit variable name in the editor or in the window, that has just poped up. The suggestions on naming are the same. To get them in the popup window you can press Arrow down key.

          • Funivan

            My feeling: inline rename is faster. I do not see any popup windows with several buttons.
            Real economy is single keys.
            When I use in-line rename I already see variable variants and take decision: hit down/up and enter to select variable name from suggest or use my variable name. In old phpstorm version without in-line rename i do not see any suggestions. I must to use arrow keys to see them. It is a little bit longer. IMHO

          • Vladislav Rastrusny

            OK, I see. Thanks. Feeling is ok. I just was surprised by “a lot of keys”.

          • lazycommit

            and then “Alt+D”

  • SamDark

    That’s great! Am I right that it was the feature in one of first WebIDE EAP series?

    • Maxim Kolmakov

      Good memory! Yes, it’s true but it was disabled since it didn’t work properly in many scenarios.

  • Yehor Konoval

    Is the old way still available?

    • Maxim Kolmakov

      Yes, it’s possible to disable “inplace” refactoring in “Settings>Editor>General>Enable in-place mode”

      • Yehor Konoval

        great! thanks.

  • Алексей traster100

    nice jobs, guys!

  • Robert Mirabelle

    This feature, though appealing, is fundamentally useless for me. If you select the ENTIRE variable to rename (as I do 90% of the time by double-clicking) before typing Shift + F6, you are FORCED to retype the $ or it will be removed and screw up your code. Conversely, this function works correctly if you simply single click somewhere within the variable without selecting it fully. If this inconsistency could be fixed, I would love this feature. Until then, I have to disable it.