You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Nice package! So annoying that PHP doesn't provide this logic in their standard libs. However, even with these functions i still have to type check before calling them: $iterable instanceof \Traversable ? iterator_xxx : array_xxx. Would be epic if agnostic variants where introduced (e.g. iterable_map, iterable_keys, iterable_flip. Then you could just pas an iterable and the function would do the rest. I think they should return what they where fed so array if is_array($iterable), otherwise \Traversable.
The text was updated successfully, but these errors were encountered:
just came across this very same issue with collections...
Doctrine Collections or Knapsack Collections use IteratorAggregate, not Iterator... so that is not working out well...
They all boil down to \iterable though
I'm thinking of using iterable instead of Iterator. But the functions will always return an Iterator. I feel like this makes the most sense for this package. Just piping stuff through to the array equivalent doesn't feel right..
Nice package! So annoying that PHP doesn't provide this logic in their standard libs. However, even with these functions i still have to type check before calling them:
$iterable instanceof \Traversable ? iterator_xxx : array_xxx
. Would be epic if agnostic variants where introduced (e.g.iterable_map
,iterable_keys
,iterable_flip
. Then you could just pas aniterable
and the function would do the rest. I think they should return what they where fed soarray
ifis_array($iterable)
, otherwise\Traversable
.The text was updated successfully, but these errors were encountered: