PSR-2 rules in PhpStorm 2016.2.1

Hello,
In PSR-2 rules
http://www.php-fig.org/psr/psr-2/
There is rule :
Code MUST use 4 spaces for indenting, not tabs.
Does in mean that in using PhpStorm 2016.2.1 for Editor->Code Style->PHP
must be set next properties
http://imgur.com/a/siKEB
?
And similar properties must be used for all menu items below ?
Thanks!

0
5 comments

Hi there,

There is a "Set from..." link in the top right part of that screen -- use it to quickly apply PSR-2 compatible rules:

 

0
Avatar
Permanently deleted user

Sorry I do not see this link http://imgur.com/a/JPJh2
Have I to activate some options/plugins ?

0

>Sorry I do not see this link

That's because it's under "Settings | Editor | Code Style | PHP" (we were talking about settings here, right?) and not inside the editor area.

0
Avatar
Permanently deleted user

Thank you I found it. But What happens when I select “PSR1/PSR2” here? As I see properties are changed in my setting page?
Also I mean if there is a way to show some errors/warnings if some blocks of my code does not corresponde to PSR2 ?

0

> As I see properties are changed in my setting page?

Yes

https://www.jetbrains.com/help/phpstorm/2017.1/configuring-code-style.html#d460202e134

 

>Also I mean if there is a way to show some errors/warnings if some blocks of my code does not corresponde to PSR2 ?

You may use PHP Code Sniffer with correct rules for that:

https://confluence.jetbrains.com/display/PhpStorm/PHP+Code+Sniffer+in+PhpStorm

0

Please sign in to leave a comment.