Features Releases

New in 4.0: Drupal coding style support

PhpStorm 4.0 contains a bundled predefined coding style for the popular Drupal content management platform. Currently just reformatting your code in PhpStorm removes 99% of errors reported by Drupal coder-review and makes your code fit to Drupal coding standards.

Setting It Up

You can either use your existing code style scheme or create another one. In both cases it works the same way: Drupal settings are applied to your currently selected scheme. After choosing Settings|Code Style|PHP, simply click to “Set from…” link at the right top corner and select Predefined Style|Drupal as shown below:

The settings which are not required (explicitly specified) by Drupal coding style are left unchanged.

Drupal-style Formatter in Action

Let’s take a small code fragment, for example:

After reformatting the code will be adjusted according to Drupal coding standards:


If you run Drupal coder-review afterwards, it will likely report few errors/warnings instead of hundreds which you normally would have with an arbitrary code not following Drupal coding standards. All the messages like “Use an indent of 2 spaces”, “Curly braces { should end a line” etc. will be gone.

It’s a nice feature to try in PhpStorm 4.0 EAP if you are coding for Drupal. Let us know what you think about it and submit your findings and improvement suggestions in YouTrack.

image description