1.2.537. Identical Conditions¶
These logical expressions contain members that are identical.
This means those expressions may be simplified.
<?php
// twice $a
if ($a || $b || $c || $a) { }
// Hiding in parenthesis is bad
if (($a) ^ ($a)) {}
// expressions may be large
if ($a === 1 && 1 === $a) {}
?>
1.2.537.1. Suggestions¶
Merge the two structures into one unique test
Add extra expressions between the two structures
Nest the structures, to show that different attempts are made
1.2.537.2. Specs¶
Short name |
Structures/IdenticalConditions |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Critical |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Examples |
|
Available in |