Features Releases

New in 3.0: More ‘Surround With’ actions for PHP

There are new ‘Surround With’ actions introduced in PhpStorm 3.0

Surround with: ‘(expr)’ and ‘!(expr)’

This couple of actions can help you quickly surround expressions with braces or negate logical expressions.

Suppose you want to negate some expression. Select the expression using the ‘Select Word at Caret’ action (‘Ctrl+W’ on WindowsLinux or ‘Cmd + W’ on Mac):

Invoke the ‘Surround With’ (‘Ctrl + Alt + T’ on WindowsLinux or ‘Cmd +Option + T’ on Mac) action and select ‘!(expr)’:

The cursor will be placed at the end of the expression:

Surround with: ‘if(expr){…}’ and ‘while(expr){…}’

You probably remember our blogpost about writing assignments with ‘Introduce Variable’ refactoring. This time we want to introduce you another hint in quick writing ‘if’ and ‘while’ statements.

Suppose you want to write the following ‘if’ statement:

Let’s start writing it using the ‘Surround With’ action. First of all, write the condition:

Select the condition:

Invoke the ‘Surround With’ action and select ‘if(expr){…}’:

Then start typing the ‘if’ statement body:

Develop with pleasure!

image description