1.2.1472. Wrong Typed Name¶
The parameter name doesn’t reflect the type used.
There are no restriction on parameter names, except its uniqueness in the signature. Yet, using a scalar type as the name for another typed value is just misleading.
This analysis relies on exact names : calling an array a list of string
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.1472.1. Connex PHP features¶
1.2.1472.1.1. Suggestions¶
Rename the parameter
1.2.1472.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 |