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!
Please sign in to leave a comment.
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:
Sorry I do not see this link http://imgur.com/a/JPJh2
Have I to activate some options/plugins ?
>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.
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 ?
> 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