1.2.250. Could Be Array Typehint¶
This rule spots arguments, class constants, properties or return values that may be labeled with the array
scalar typehint.
<?php
// $arg is used as an array in this function, so it may be typed : array
functions foo($arg) {
// the returned value is always an array, so this function might be typed as : array
return array($arg[3]);
}
?>
See also Type declarations.
1.2.250.1. Connex PHP features¶
1.2.250.1.1. Suggestions¶
Add array typehint to the code.
1.2.250.1.2. Specs¶
Short name |
Typehints/CouldBeArray |
Rulesets |
|
Exakat since |
2.1.2 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Available in |