1.2.672. Merge If Then¶
Two nested if/then may be merged into one, by merging the two conditions. This is often a development artifact.
<?php
// two merged conditions
if ($a == 1 && $b == 2) {
// doSomething()
}
// two distinct conditions
// two nesting
if ($a == 1) {
if ($b == 2) {
// doSomething()
}
}
?>
1.2.672.1. Suggestions¶
Merge the two structures into one
1.2.672.2. Specs¶
Short name |
Structures/MergeIfThen |
Rulesets |
|
Exakat since |
1.9.9 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Features |
if-then |
Available in |