src/Arr.php
public static function from($iterable)
    {
        if (is_array($iterable)) {
            return $iterable;
        }
        // Don't mean to play favorites, but want to optimize where we can.
        if ($iterable instanceof ImmutableBag) {
            return $iterable->toArray();
        }
        if ($iterable instanceof Traversable) {
            return iterator_to_array($iterable);
        }
        if ($iterable === null) {
            return [];
        }
        if ($iterable instanceof \stdClass) {
            return (array) $iterable;
        }

        Assert::nullOrIsIterable($iterable);
    }
public static function from($iterable)
    {
        if (is_array($iterable)) {
            return $iterable;
        }
        // Don't mean to play favorites, but want to optimize where we can.
        if ($iterable instanceof ImmutableBag) {
            return $iterable->toArray();
        }
        if ($iterable instanceof Traversable) {
            return iterator_to_array($iterable);
        }
        if ($iterable === null) {
            return [];
        }
        if ($iterable instanceof \stdClass) {
            return (array) $iterable;
        }

        Assert::nullOrIsIterable($iterable);
    }
Converts an `iterable`, `null`, or `stdClass` to an array.

@param iterable|null|\stdClass $iterable

@return array