1.2.532. Identical Case In Switch¶
This can happen by mistake or design. They may be merged together.
<?php
switch($a) {
case 1:
$b = 2;
break;
case 2:
$b = 12;
break;
// Identical to case 1
case 3:
$b = 2;
break;
}
?>
1.2.532.1. Suggestions¶
Merge the cases and reduce the size of code
Review the cases code and make them different
1.2.532.2. Specs¶
Short name |
Structures/IdenticalCase |
Rulesets |
|
Exakat since |
2.5.3 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Features |
dry |
Available in |