public static function toArray($value)
    {
        if (!is_array($value) && !$value instanceof Traversable) {
            $name = static::of($value);
            throw new TypeException("Can only cast Traversable and arrays to array, not $name");
        }

        return is_array($value) ? $value : iterator_to_array($value);
    }
public static function toArray($value)
    {
        if (!is_array($value) && !$value instanceof Traversable) {
            $name = static::of($value);
            throw new TypeException("Can only cast Traversable and arrays to array, not $name");
        }

        return is_array($value) ? $value : iterator_to_array($value);
    }
public static function toArray ( $ value ) { if ( ! is_array ( $ value ) && ! $ value instanceof Traversable ) { $ name = static :: of ( $ value ) ; throw new TypeException ( "Can only cast Traversable and arrays to array, not $name" ) ; } return is_array ( $ value ) ? $ value : iterator_to_array ( $ value ) ; }
Make something an array.

@param array|Traversable $value

@return array

@throws TypeException
Make something an array .