
Rule logical_operators
ΒΆ
Use &&
and ||
logical operators instead of and
and or
.
WarningΒΆ
Using this rule is riskyΒΆ
Risky, because you must double-check if using and/or with lower precedence was intentional.
ExamplesΒΆ
Example #1ΒΆ
--- Original
+++ New
<?php
-if ($a == "foo" and ($b == "bar" or $c == "baz")) {
+if ($a == "foo" && ($b == "bar" || $c == "baz")) {
}
Rule setsΒΆ
The rule is part of the following rule sets: