Rename refactorings
Rename refactorings allow you to rename symbols and files with all the references to them in the code corrected automatically.
Rename a symbol
Select an item to be renamed.
To select a file, click the desired file in the Project tool window.
To select a symbol in the editor, place the caret at the name of the symbol to be renamed.
To select a symbol in the Project tool window, make sure that the members are shown, and then click the desired symbol.
To select a symbol in the Structure view, click the desired symbol in the Structure tool window Alt+7.
Select
from the context menu or press Shift+F6.The subsequent behavior depends on the refactoring mode selected under .
By default, the In the editor option is selected and the suggested name appears right below the symbol. You can either accept the suggestion, or type a new name you can type a new name in the highlighted line in the editor. If you press Shift+F6 once more, PhpStorm will display the Rename dialog with more options.
If the In modal dialogs option is selected, the Rename dialog opens immediately.
PhpStorm displays and next to the highlighted element.
You can click these icons or press Tab to open the context menu and select the additional rename options.
Comments and strings: the occurrences of the symbol will be also renamed in comments and string literals.
Text occurrences: the occurrences of the symbol will be also renamed in files that don't contain any source code (documentation, text files, HTML files, and so on).
If you want to change other refactoring options or preview the refactoring results, click the More options link or press Shift+F6. In the dialog that opens, you can select the refactoring scope and click Preview to preview the changes in a separate tool window before applying them.
Rename a file or directory
Select the file or directory in the Project tool window.
Press Shift+F6 or select
from the context menu.In the Rename dialog that opens, specify the new name.
Select the Search in comments and strings checkbox to let PhpStorm apply changes to comments and strings.
Click Preview to observe possible changes in Find Tool Window. Click Refactor to proceed.
PhpStorm finds all the occurrences of the filename and changes them respectively.