Reputation: 733
I am using PHP_CodeSniffer like this to scan my code:
vendor/bin/phpcs --standard=PSR12 src
I also configured PhpStorm to use PSR-12 at Preferences -> Editor -> Code Style -> Set From -> PSR12
When I run PHP_CodeSniffer there are no error at first, but if U auto indent with PhpStorm my file and re run PHP_CodeSniffer I get some errors:
286 | ERROR | [x] Multi-line function call not indented correctly; expected 12 spaces but found 16
287 | ERROR | [x] Multi-line function call not indented correctly; expected 12 spaces but found 16
288 | ERROR | [x] Multi-line function call not indented correctly; expected 12 spaces but found 16
I tried to change the configuration of tabs and indents, by default it's this:
I've not found any configuration that works, and I don't understand what could be the problem since I use PSR12 in both PhpStorm and PHP_CodeSniffer.
I also have this phpcs.xml
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer"
xsi:noNamespaceSchemaLocation="phpcs.xsd">
<description>The coding standard for PHP_CodeSniffer itself.</description>
<file>src</file>
<arg name="basepath" value="."/>
<arg name="colors"/>
<arg name="parallel" value="8"/>
<arg value="p"/>
<arg value="s"/>
<!-- Don't hide tokenizer exceptions -->
<rule ref="Internal.Tokenizer.Exception">
<type>error</type>
</rule>
<rule ref="PSR12"></rule>
<rule ref="PSR2"></rule>
<rule ref="PSR1"></rule>
</ruleset>
Upvotes: 2
Views: 1082