PhpStorm 10.0 Help

Using Postfix Templates


Postfix code completion lets you transform an already typed expression to another one based on the postfix you type after a dot, the type of the expression, and its context. This transformation is performed by expanding the postfix-specific predefined template. For example, the .if postfix applied to a boolean expression wraps it with an if statement. See more at:

Activating and de-activating postfix templates

When the postfix template functionality is enabled, PhpStorm transforms expressions with postfixes into other expressions by expanding the corresponding postfix-specific templates.

To activate the postfix templates functionality:

  1. Open the Settings / Preferences Dialog by choosing File | Settings for Windows and Unix or PhpStorm | Preferences for OS X. Expand the Editor node, and then click Postfix under General.

    The Editor: Postfix Completion page that opens shows a list of postfixes for which PhpStorm can transform expressions according to postfix-specific templates. Transformation templates are shown next to corresponding postfixes. When you select a postfix, the Description pane illustrates the corresponding transformation showing the code snippet before and after the template is expanded.

  2. Select the Enable postfix templates check box and choose the key to launch template expansion from the Expand template with drop-down list.
  3. Select the check boxes next to the postfixes for which you want PhpStorm to expand the corresponding templates.

To suppress expanding a template, clear the check box nex to the corresponding postfix. To block the postfix templates functionality, clear the Enable postfix templates check box.

Using postfix templates

To apply a postfix template, type your code followed by a dot, then type the desired postfix, and press the key that is appointed for template expansion on the Postfix Templates page of the editor settings.

See Also

Last modified: 23 December 2015