@mnapoli opened this issue on June 25th 2015

We encourage contributors to set up PhpStorm with our own code style configuration. It is described here as well as in the developer documentation.

I think we should remove that custom config and just use the PSR-2 configuration in PhpStorm. The current style in Piwik's codebase is still not consistent with PSR-2, and the PhpStorm config we distribute doesn't fix that. Using PSR-2 all the way would be much simpler, and less surprising for contributors and new team members.

To sum up: - we should stop distributing a custom PhpStorm config and encourage using the PSR-2 default config instead - we (as in contributors) should switch to the PSR-2 config


@mattab commented on June 25th 2015


years ago when I tried to convert all the codebase to PSR-2 back then Phpstorm did some weird things, this is why we customised the config. But it was long time ago, and it seems PSR1-2 conversion looks good today in phpstorm!

#### How to enable PSR1/2 in Phpstorm

From application preferences, either scroll down to the Code Style section, then choose PHP, or type PHP in the search box, which will filter the options available for you and then click PHP under Code Style. Click PSR1/PSR2, then click OK in the bottom right of the preferences window. You don’t need to restart PHPStorm as the setting change applies immediately.


Related: #7731 #7955

@mattab commented on January 18th 2016

Piwik is now using PSR2 as suggested. the dev documentation was updated to remove link to our custom PSR file (which was also removed).

@mattab commented on January 18th 2016

See also: follow up issue Automatically convert our code base to use a consistent code style #9545

@edgreenberg commented on September 25th 2016

Having followed the instructions in @mattab 's comment above, I find that using the reformat command ctrl-alt-shift-L reformats my code to PSR-2 (adding spaces, moving curly brackets, etc.) but if I type in code that is malformed, for instance public function foo(){ I do not get any notification that I've violated PSR-2. Are my expectations wrong?

@mattab commented on September 26th 2016

Hello @edgreenberg AFAIK there is no warning or notice that the code is not compliant with PSR2 and one has to apply manually, or directly code in PSR2 style

This issue was closed on January 18th 2016
Powered by GitHub Issue Mirror