DusanKasan / Knapsack

Collection pipeline library for PHP
http://dusankasan.github.io/Knapsack/
MIT License
536 stars 56 forks source link

Ensure that input factory returns array or Traversable when created from a callable #36

Closed jdreesen closed 7 years ago

jdreesen commented 7 years ago

The return value from the input factory was not checked when the Collection is created from a callable. As only arrays and Traversables are valid return types, this should be checked.

Also IteratorAggregate::getIterator() must return a Traversable so we need to wrap the return value of the input factory in an ArrayIterator in case it is an array.

DusanKasan commented 7 years ago

Looks good. Thank you for the contribution.