src/precore/util/Iterables.php
public static function from(Traversable $traversable) : IteratorAggregate
    {
        Preconditions::checkArgument($traversable instanceof Iterator || $traversable instanceof IteratorAggregate);
        return $traversable instanceof IteratorAggregate
            ? $traversable
            : new CallableIterable(
                function () use ($traversable) {
                    return $traversable;
                }
            );
    }
public static function from(Traversable $traversable) : IteratorAggregate
    {
        Preconditions::checkArgument($traversable instanceof Iterator || $traversable instanceof IteratorAggregate);
        return $traversable instanceof IteratorAggregate
            ? $traversable
            : new CallableIterable(
                function () use ($traversable) {
                    return $traversable;
                }
            );
    }
Creates an {@link IteratorAggregate} from traversable, regardless of its type.

@param Traversable $traversable
@return IteratorAggregate