1.2.278. Could Drop Variable¶
<?php
try {
doSomething();
} catch(Exception1 $e) {
// No usage of $e : just drop it from the clause
} catch(Exception2 $e2) {
// $e2 is caught and used.
echo $e2->getMessage();
}
?>
1.2.278.1. Suggestions¶
Remove the unused variable
1.2.278.2. Specs¶
Short name |
Exceptions/CouldDropVariable |
Rulesets |
|
Exakat since |
2.6.4 |
PHP Version |
With PHP 8.0 and more recent |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Features |
catch |
Available in |