public static function ensureTraversable($items): \Traversable
    {
        if ($items instanceof \Traversable) {
            return $items;
        }

        if (is_array($items)) {
            return self::fromArray($items);
        }

        throw new \InvalidArgumentException('Un-handled argument of type: '.get_class($items));
    }
public static function ensureTraversable($items): \Traversable
    {
        if ($items instanceof \Traversable) {
            return $items;
        }

        if (is_array($items)) {
            return self::fromArray($items);
        }

        throw new \InvalidArgumentException('Un-handled argument of type: '.get_class($items));
    }
public static function ensureTraversable ( $ items ) : \ Traversable { if ( $ items instanceof \ Traversable ) { return $ items ; } if ( is_array ( $ items ) ) { return self :: fromArray ( $ items ) ; } throw new \ InvalidArgumentException ( 'Un-handled argument of type: ' . get_class ( $ items ) ) ; }
Ensures that the given items are \Traversable.

Usage:

```
IteratorTools::ensureTraversable([1, 2, 3]);
IteratorTools::ensureTraversable(new \ArrayIterator([1, 2, 3]));
```

@param mixed $items

@throws \InvalidArgumentException
Ensures that the given items are \ Traversable .