1.2.962. Parameter Hiding¶
When a parameter is set to another variable, and never used.
While this is a legit syntax, parameter hiding tends to make the code confusing. The parameter itself seems to be unused, while some extra variable appears.
Keep this code simple by removing the hiding parameter.
<?php
function substract($a, $b) {
// $b is given to $c;
$c = $b;
// $c is used, but $b would be the same
return $a - $c;
}
?>
1.2.962.1. Connex PHP features¶
1.2.962.1.1. Suggestions¶
Remove the parameter alias and use the parameter
Add some modifications to the alias parameter and use it
1.2.962.1.2. Specs¶
Short name |
Functions/ParameterHiding |
Rulesets |
|
Exakat since |
1.9.8 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Available in |