1.2.1237. Typehint Could Be Iterable¶
Mark arguments, class constants, properties and return types that can be set to iterable
.
<?php
// Accept an array or a traversable Object as input
function foo($b) {
foreach($b as $c) {
}
// Returns an array
return [$b];
}
?>
1.2.1237.1. Connex PHP features¶
1.2.1237.1.1. Suggestions¶
Add iterable typehint to the code (PHP 8.0+).
1.2.1237.1.2. Specs¶
Short name |
Typehints/CouldBeIterable |
Rulesets |
|
Exakat since |
2.1.4 |
PHP Version |
All |
Severity |
Major |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Available in |