1.2.284. 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.284.1. Connex PHP features¶
1.2.284.1.1. Suggestions¶
Add the
arraytypehint to the function.Add the
iterabletypehint to the function.Add the
traversabletypehint to the function.
1.2.284.1.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 |
Available in |