Skip to content

Commit

Permalink
[phpcs] Fix blank line detection
Browse files Browse the repository at this point in the history
Squiz.WhiteSpace.SuperfluousWhitespace has problems detecting blank
lines in functions when used together with the PSR2 standard.

More information: squizlabs/PHP_CodeSniffer#600

This commit fixes that issue by restoring the original behavior.
It also adds rules for function spacing because the sniff mentioned
above does only work within functions.
  • Loading branch information
logmanoriginal committed Dec 26, 2018
1 parent 4b22862 commit ce65f51
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,22 @@
<!-- Do not add a whitespace before a semicolon -->
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
<!-- Do not add whitespace at start or end of a file or end of a line -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<!--
This fixes an issue in combination with PSR2
https://github.com/squizlabs/PHP_CodeSniffer/issues/600
-->
<property name="ignoreBlankLines" value="false"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
<properties>
<property name="spacing" value="1" />
<property name="spacingBeforeFirst" value="0" />
<property name="spacingAfterLast" value="0" />
</properties>
</rule>
<!-- Whenever possible use single quote strings -->
<rule ref="Squiz.Strings.DoubleQuoteUsage">
<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar" />
Expand Down

0 comments on commit ce65f51

Please sign in to comment.