PhpStorm 2018.3 Help

Extract Field Dialog

Refactor | Extract Field
Ctrl+Alt+F


Item

Description

Name

In this text box, specify the name of the new field.

Initialize in

In this area select where the new field will be initialized in.

When you work with PHPUnit tests, PhpStorm also lets you initialize the field in the setUp method. For more details on working with PHPUnit in PhpStorm, see Testing with PHPUnit.

Visibility

In this area, specify the visibility scope for the new field. The available options are:

  • Public - if you select this option, the new field will be accessible from anywhere.

  • Private - if you select this option, the new field will be accessible only from the current class.

  • Protected - if you select this option, the new field will be accessible from the current class as well as from its inherited and parent classes.

Replace all occurrences

Select this checkbox to have PhpStorm automatically replace all the occurrences of the selected expression.

The checkbox is enabled only if the selected expression is used more than once in the class. All the found occurrences of the expression are highlighted.

Last modified: 7 December 2018

See Also

Procedures: