Skip to content

Commit a260482

Browse files
committed
Ruleset: forbid use of the ! not operator
`0` is a valid token stack pointer, so in most cases a loosey comparison against `false` in conditions is dangerous in the context of code for PHPCS. With that in mind, I propose forbidding it.
1 parent 4b9fdd2 commit a260482

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

PHPCSDev/ruleset.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@
151151
<!-- Only one object structure per file. -->
152152
<rule ref="Generic.Files.OneObjectStructurePerFile"/>
153153

154+
<!-- Disallow non-strict comparisons and the use of the not operator. -->
155+
<rule ref="Squiz.Operators.ComparisonOperatorUsage">
156+
<exclude name="Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue"/>
157+
</rule>
158+
154159

155160
<!--
156161
####################################################################

0 commit comments

Comments
 (0)