1.2.1459. Wrong Typehinted Name¶
The parameter name doesn’t reflect the typehint used.
There are no restriction on parameter names, except its uniqueness in the signature. Yet, using a scalar typehint as the name for another typehinted value is just misleading.
This analysis relies on exact names : calling an array a list of strings is OK with this analysis.
This analysis relies on a few variations of names : bool and boolean, int and integer.
<?php
function foo(string $array,
int $int) {
// doSomething()
}
function bar(array $strings) {
// doSomething()
}
?>
1.2.1459.1. Connex PHP features¶
1.2.1459.1.1. Suggestions¶
Rename the parameter
1.2.1459.1.2. Specs¶
Short name |
Functions/WrongTypehintedName |
Rulesets |
|
Exakat since |
2.0.2 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Available in |