Skip to content

Commit 5c14fbd

Browse files
committed
Ruleset: add a few extra sniffs + a property for one of the PSR12 sniffs
* The `PSR12.ControlStructures.BooleanOperatorPlacement` sniffs checks for consistent placement of boolean operators in control structure conditions. The extra property enforces that these are always placed at the start of a line. * PSR12 has no opinion on array formatting. The `Generic.Arrays.ArrayIndent` sniff will at least safeguard some semblance of normalized arrays. * The `Generic.CodeAnalysis.EmptyPHPStatement` prevents empty PHP statements, like when there is a duplicate semi-colon at the end of a statement. * The `Generic.ControlStructures.DisallowYodaConditions` ensures that conditions never use Yoda. * Additionally, the `Generic.CodeAnalysis.ForLoopShouldBeWhileLoop`, `Generic.CodeAnalysis.JumbledIncrementer`, `Generic.CodeAnalysis.UnconditionalIfStatement`, `Generic.CodeAnalysis.UnnecessaryFinalModifier`, `Generic.PHP.ForbiddenFunctions` and the `Squiz.WhiteSpace.SemicolonSpacing` sniffs, which were already in use in the PHP Parallel Lint repo, but not in the other repos, have also been added. Note: the `Generic.PHP.DeprecatedFunctions` sniff, as used in the PHP Parallel Lint repo, has **not** been added as the PHPCompatibility standard included a far more comprehensive and stable sniff for the same.
1 parent 475f6f1 commit 5c14fbd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

PHPParallelLint/ruleset.xml

+19
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,40 @@
2323
</properties>
2424
</rule>
2525

26+
<rule ref="PSR12.ControlStructures.BooleanOperatorPlacement">
27+
<properties>
28+
<!-- Only allow them at the start of the line. -->
29+
<property name="allowOnly" value="first"/>
30+
</properties>
31+
</rule>
32+
2633

2734
<!--
2835
#############################################################################
2936
MISCELLANEOUS ADDITIONAL RULES
3037
#############################################################################
3138
-->
3239

40+
<rule ref="Generic.Arrays.ArrayIndent"/>
41+
3342
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
43+
<rule ref="Generic.CodeAnalysis.EmptyPHPStatement"/>
44+
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
45+
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
46+
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
47+
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
3448
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
3549

50+
<rule ref="Generic.ControlStructures.DisallowYodaConditions"/>
51+
3652
<rule ref="Generic.Formatting.SpaceAfterCast"/>
3753

3854
<rule ref="Generic.Metrics.CyclomaticComplexity"/>
3955
<rule ref="Generic.Metrics.NestingLevel"/>
4056

4157
<rule ref="Generic.NamingConventions.ConstructorName"/>
4258

59+
<rule ref="Generic.PHP.ForbiddenFunctions"/>
4360
<rule ref="Generic.PHP.NoSilencedErrors"/>
4461

4562
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
@@ -52,4 +69,6 @@
5269
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
5370
<rule ref="Squiz.PHP.NonExecutableCode"/>
5471

72+
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
73+
5574
</ruleset>

0 commit comments

Comments
 (0)