1.2.283. Could Type With Array¶
That argument may be typed with
array
. Based on usage, it was determined that the only type possible is a array.
<?php
// $a is used with a function which requires an int.
function foo($a) {
return array_keys($a);
}
?>
See also Type declarations.
1.2.283.1. Suggestions¶
Add the
array
typehint to the function.Add the
iterable
typehint to the function.Add the
traversable
typehint to the function.
1.2.283.2. Specs¶
Short name |
Functions/CouldTypeWithArray |
Rulesets |
|
Exakat since |
1.9.9 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Features |
class |
Available in |