Review: fromIterable
kelunik opened this issue · comments
Niklas Keller commented
I guess this could move to a static method on Pipeline
? Maybe even split it into fromClosure
and fromIterable
?
/** @psalm-suppress RedundantConditionGivenDocblockType */
if (!$iterable instanceof \Generator) {
$iterable = (static fn () => yield from $iterable)();
}
I'm not sure why this code exists.
Our current intermediate operations do all nothing until there's a terminal operation, but fromIterable
starts iterating right away currently.
Aaron Piotrowski commented
Two methods on Pipeline
makes a lot of sense I think. Maybe all the functions should be static methods on Pipeline now?
I'm not sure why this code exists.
Probably a leftover from when pipelines were always created from generators. Not sure.