Skip to main content
Drupal 8

Main navigation

  • Home
    • Question And Answer
    • NEWS
    • Projects
  • Tutorials - Drupal
    • Android
    • Other
User account menu
  • Log in

Breadcrumb

  1. Home

Configure PhpStorm for Drupal coding standards

By editor , 4 May, 2018
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

 

File
DrupalPHPCS.zip (789 bytes)

Tags

  • Drupal 8
  • IDE
PhpStorm IDE - Develop drupal modules
Drupal coding Standard and Best Practice
Add PhpStorm icon To Linux ubuntu Menu

Comments

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Links

  • Drupal.org
  • Drupal core release cycle
  • Drupal events with ease
  • Unit test with Drupal using PHPUnit (Drupal 10)
  • Tokens for file upload url
  • Tips for Docker
  • CKEditor inline image files usage for custom forms.
  • Install Docker on Linux Mint
  • Install PHP 8.1
  • Drupal Security Best Practices
  • Order and sort items with tabledrag
  • Add a custom service YAML container
  • Apply a patch with composer