Inline
PhpStorm provides the following inline refactorings:
The Inline Constant refactoring replaces redundant constant usage with its initializer. This refactoring is opposite to Extract constant.
You can opt to do any of the following:
Inline all occurrences of the constant, and delete the constant,
Inline all occurrences of the constant, and keep the constant,
Inline a single occurrence, and keep the constant.
The Inline Variable refactoring replaces redundant variable usage with its initializer. This refactoring is opposite to Extract/Introduce variable.
The Inline Method refactoring results in placing the method's or function's body into the body of its caller(s). This refactoring is opposite to Extract method.
You can opt to do any of the following:
Inline all occurrences of the method, and delete the method,
Inline all occurrences of the method, and keep the method,
Inline a single occurrence, and keep the method.
Inline Constant
Inline Variable
PHP Example
JavaScript Example
Inline Method or Function
PHP Example
JavaScript Example
Perform inline refactoring
Position the caret at the desired symbol to be inlined.
Do one of the following:
From the main menu or from the context menu, choose
.Press Ctrl+Alt+N.
When inlining a variable, confirm the refactoring in the Inline dialog.
When inlining a method or constant, specify the inlining options in the Inline Method/Inline Constant dialog.
You can opt to do any of the following:
Inline all occurrences of the method or constant, and delete the method or constant,
Inline all occurrences of the method or constant, and keep the method or constant,
Inline a single occurrence, and keep the method or constant.