Configure PhpStorm for Drupal coding standards | Drupal 8

Configure PhpStorm for Drupal coding standards

Submitted by editor on Fri, 05/04/2018 - 10:36
Question

How to configure phpstorm for drupal coding standards / Development ?

Change default settings of PhpStorm.

File -> Default settings -> Editor -> Code Style -> PHP

Drupal recommends less than 80 characters per line.
Set "Tab size", "Indent" and "Continuation indent" to 2

On the "Wrapping and Braces tab", make sure these settings are set correctly:

Keep control statements in one line should be unchecked
Place braces in class declaration should be unchecked
Place braces in function declaration should be unchecked
Always force braces for if() statements should be checked
Force braces for while() statements should be checked
Else on new line for if() statements should be checked
'While' on new line for do...while() statements should be checked
'Catch' on new line for for try() statements should be checked
Chop down Array initializer if long should be checked
New line after ( for Array initializer should be checked
Place ) on new line for Array initializer should be checked

You can also use my predefined file from hear : Default_PhpStorm_Style.xml_.zip
Import download the file, unzip and Import from :
File -> Default settings -> Editor -> Code Style
--> Gear icon -> Import scheme -> Intelij....XML

 

Tags

Add new comment