1.2.1408. Useless Try¶
Report try clause that are useless. A try clause is useless when no exception is emitted by the code in the block.
This happens when the underlying layers removed the emission of exceptions.
<?php
try {
// Nothing is going to happen here
++$a;
} catch (Exception $e) {
}
?>
1.2.1408.1. Suggestions¶
Remove the Try clause
Add a throw among the different called methods
1.2.1408.2. Specs¶
Short name |
Exceptions/UselessTry |
Rulesets |
|
Exakat since |
2.5.3 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Medium |
Available in |