Skip to content

Commit cbf1525

Browse files
committed
PHPCS ruleset: forbid yoda conditions in VIPCS codebase
In contrast to WPCS, disallow the use of Yoda conditions.
1 parent 8ff3fa9 commit cbf1525

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.phpcs.xml.dist

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<exclude name="WordPress.Files.FileName"/>
1818
<exclude name="WordPress.NamingConventions.ValidVariableName"/>
1919
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
20+
<exclude name="WordPress.PHP.YodaConditions"/>
2021
</rule>
2122

2223
<rule ref="WordPress-Docs"/>
@@ -32,9 +33,12 @@
3233

3334
<rule ref="PSR2.Methods.FunctionClosingBrace"/>
3435

35-
<!-- Disallow long array syntax -->
36+
<!-- Disallow long array syntax. -->
3637
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
3738

39+
<!-- Disallow Yoda conditions. -->
40+
<rule ref="Generic.ControlStructures.DisallowYodaConditions"/>
41+
3842
<!-- Check code for cross-version PHP compatibility. -->
3943
<config name="testVersion" value="5.4-"/>
4044
<rule ref="PHPCompatibility">

0 commit comments

Comments
 (0)