Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Redirect
locationhttps://www.jetbrains.com/help/phpstorm/refactoring-source-code.html
delay2

Include Page
Social Buttons PhpStorm
Social Buttons PhpStorm

...

Tip

While this tutorial covers refactorings for PHP, the IDE also supports refactoring other languages like JavaScript, HTML and so forth. Give refactoring a try in these languages as well; the Refactor This is available in the editor for them, too.

...

To do this, we can use the Refactor | Rename... context menu on any file or symbol, or place the cursor on it and use the Ctrl+F6 keyboard shortcut to invoke the rename refactoring immediately. Note that we could also use the Refactor This action. This last one is very convenient to invoke refactorings as we only need to remember one keyboard shortcut, Ctrl+Shift+Alt+T (Ctrl-T on Mac OS X), to show a pop-up with the different refactorings that we can do.

...

Extract Field Refactoring

Similar to the #Extract Constant Refactoring, we can select a value in the editor and extract it into a field by pressing Ctrl+Alt+F (or Alt-CMD-F on Mac OS X). We can let PhpStorm initialize the field with the selected value in the class constructor, in the field declaration or in the method where we selected the value.

...

No keyboard shortcut is assigned for this refactoring. Use Refactor This or the Refactor | Extract Interface context menu.

...

The Inline Refactoring Replace is the opposite of Extract Variable / Extract Method refactorings: it replaces redundant variables or functions with the full expression. We can select a variable and press Ctrl+Alt+N (or Alt-CMD-N on Mac OS X) to invoke it.

...

No keyboard shortcut is assigned for this refactoring. Use Refactor This or the Refactor | Pull Members Up or Refactor | Push Members Down context menu.

...