Skip to content

Commit 5d159d2

Browse files
committed
PHPCSDev ruleset: add a few select additional rules
See the inline documentation of the ruleset for more information.
1 parent b79fae6 commit 5d159d2

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

PHPCSDev/ruleset.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@
117117
<!-- Disallow Yoda conditions. -->
118118
<rule ref="Generic.ControlStructures.DisallowYodaConditions"/>
119119

120+
<!-- Use self or static when referring to the class in use. -->
121+
<rule ref="Squiz.Classes.SelfMemberReference"/>
122+
123+
<!-- Only one object structure per file. -->
124+
<rule ref="Generic.Files.OneObjectStructurePerFile"/>
125+
120126

121127
<!--
122128
####################################################################
@@ -179,4 +185,37 @@
179185
<exclude name="PEAR.Commenting.ClassComment.DuplicateSinceTag"/>
180186
</rule>
181187

188+
189+
<!--
190+
####################################################################
191+
Code Analysis additions.
192+
####################################################################
193+
-->
194+
195+
<!-- Efficiency: don't use function calls within the condition of a for loop. -->
196+
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
197+
198+
<!-- Efficiency: don't use size functions within a loop. -->
199+
<rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops"/>
200+
201+
<!-- Efficiency: don't unnecessarily use double quotes. -->
202+
<rule ref="Squiz.Strings.DoubleQuoteUsage.NotRequired"/>
203+
204+
<!-- Error prevention: warns when an inner loop uses the same incrementor as the outer loop. -->
205+
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
206+
207+
<!-- Error prevention: don't assign from within a condition. -->
208+
<rule ref="Generic.CodeAnalysis.AssignmentInCondition">
209+
<exclude name="Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition"/>
210+
</rule>
211+
212+
<!-- Clean up: remove redundant code. -->
213+
<rule ref="Squiz.PHP.NonExecutableCode"/>
214+
215+
<!-- Clean up: no empty statements. -->
216+
<rule ref="Generic.CodeAnalysis.EmptyPHPStatement"/>
217+
218+
<!-- Parse error prevention: guard against merge conflict artifacts. -->
219+
<rule ref="Generic.VersionControl.GitMergeConflict"/>
220+
182221
</ruleset>

0 commit comments

Comments
 (0)