Fork me on GitHub
a Sensio Labs Product

7th Gear (v3.57.2) edition

Rule logical_operators

Use && and || logical operators instead of and and or.


Using this rule is risky

Risky, because you must double-check if using and/or with lower precedence was intentional.


Example #1

--- Original
+++ New

-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:


The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.