Code Inspection: Expression without clarifying parentheses
Reports potentially ambiguous expressions and proposes enclosing them in clarifying parentheses.
By using parentheses, you can increase code readability by grouping operations explicitly rather than relying on the implicit operator precedence and associativity. See Operator Precedence (php.net) for details.
In the following example, several potential ambiguities are eliminated by introducing parentheses inside expressions.
$a = 1 - 2 + 3; $b = true && false || true && false && true; $c = true ? $a == 2 : $a + 1 == 3 ? $a : !$b;
$a = (1 - 2) + 3; $b = (true && false) || (true && false && true); $c = true ? ($a == 2) : ($a + 1 == 3 ? $a : !$b);