1.2.1203. Throws An Assignement¶
It is possible to throw an exception, and, in the same time, assign this exception to a variable.
However, the variable will never be used, as the exception is thrown, and any following code is not executed, unless the exception is caught in the same scope.
<?php
// $e is useful, though not by much
$e = new() Exception();
throw $e;
// $e is useless
throw $e = new Exception();
?>
1.2.1203.1. Connex PHP features¶
1.2.1203.1.1. Suggestions¶
Drop the assignation
1.2.1203.1.2. Specs¶
Short name |
Structures/ThrowsAndAssign |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Instant (5 mins) |
Precision |
Very high |
Available in |