Skip to content

Latest commit

 

History

History
43 lines (29 loc) · 860 Bytes

logical_operators.rst

File metadata and controls

43 lines (29 loc) · 860 Bytes

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:

Source class

PhpCsFixer\Fixer\Operator\LogicalOperatorsFixer