Redundant Boolean literals should be removed from expressions to improve readability.
if ($booleanVariable == true) { /* ... */ }
if ($booleanVariable != true) { /* ... */ }
if ($booleanVariable || false) { /* ... */ }
doSomething(!false);
$booleanVariable = condition ? true : exp;
$booleanVariable = condition ? false : exp;
$booleanVariable = condition ? exp : true;
$booleanVariable = condition ? exp : false;
if ($booleanVariable) { /* ... */ }
if (!$booleanVariable) { /* ... */ }
if ($booleanVariable) { /* ... */ }
doSomething(true);
$booleanVariable = condition || exp;
$booleanVariable = !condition && exp;
$booleanVariable = !condition || exp;
$booleanVariable = condition && exp;
The use of literal booleans in comparisons which use identity operators (=== and !==) are ignored.