Type-hinting array rejects a generator, and hinting Traversable rejects an array — so a function meant to consume a sequence either had no hint or forced the caller to convert.
public function export(iterable $rows): void
{
foreach ($rows as $row) {
fputcsv($this->handle, $row);
}
}
$exporter->export([$a, $b]); // array
$exporter->export($this->stream()); // generator
It is a pseudo-type covering exactly what foreach accepts, which is the useful definition. The consequence worth planning for: an iterable may be a generator, so it cannot be counted, cannot be iterated twice, and may be infinite. Accepting one is a promise to consume it once and in order.