[phpcs] Add sniffs for function declaration and -calls
When declaring a function - Do not add a space before a comma - Add a space after a comma - Add a space after an equal sign Example: function myFunction($x, $y, $z = null){...} When calling a function - Do not add a space before the opening parenthesis - Do not add a space after the opening parenthesis - Do not add a space before the closing parenthesis - Do not add a space before a comma - Add a space after a comma Example: myFunction('x', 'y', 'z');
This commit is contained in:
parent
23430f1c07
commit
d8f5aa3c79
1 changed files with 16 additions and 0 deletions
16
phpcs.xml
16
phpcs.xml
|
@ -21,6 +21,13 @@
|
||||||
<property name="absoluteLineLimit" value="120"/>
|
<property name="absoluteLineLimit" value="120"/>
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
|
<!-- When calling a function: -->
|
||||||
|
<!-- Do not add a space before the opening parenthesis -->
|
||||||
|
<!-- Do not add a space after the opening parenthesis -->
|
||||||
|
<!-- Do not add a space before the closing parenthesis -->
|
||||||
|
<!-- Do not add a space before a comma -->
|
||||||
|
<!-- Add a space after a comma -->
|
||||||
|
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
|
||||||
<!-- Use UPPERCARE for constants -->
|
<!-- Use UPPERCARE for constants -->
|
||||||
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
|
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
|
||||||
<!-- Use lowercase for 'true', 'false' and 'null' -->
|
<!-- Use lowercase for 'true', 'false' and 'null' -->
|
||||||
|
@ -37,6 +44,15 @@
|
||||||
<rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
|
<rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
|
||||||
<!-- Add a new line at the end of a file -->
|
<!-- Add a new line at the end of a file -->
|
||||||
<rule ref="PSR2.Files.EndFileNewline"/>
|
<rule ref="PSR2.Files.EndFileNewline"/>
|
||||||
|
<!-- When declaring a function: -->
|
||||||
|
<!-- Do not add a space before a comma -->
|
||||||
|
<!-- Add a space after a comma -->
|
||||||
|
<!-- Add a space before and after an equal sign -->
|
||||||
|
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
|
||||||
|
<properties>
|
||||||
|
<property name="equalsSpacing" value="1"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
<!-- Do not add spaces when casting -->
|
<!-- Do not add spaces when casting -->
|
||||||
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
|
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
|
||||||
<!-- Operators must have a space around them -->
|
<!-- Operators must have a space around them -->
|
||||||
|
|
Loading…
Reference in a new issue