src/Collection.php
public function map(callable $callable)
    {
        $items = [];
        $type = null;

        foreach ($this->items as $item) {
             $result = $callable($item);

            if (null === $type) {
                $type =  gettype($result);

                if ($type === 'object') {
                    $type = get_class($result);
                }
            }

            $items[] = $result;
        }

        if (null === $type) {
            $type = $this->type;
        }

        $col = new static ($type);
        $col->setItemsFromTrustedSource($items);

        return $col;
    }
public function map(callable $callable)
    {
        $items = [];
        $type = null;

        foreach ($this->items as $item) {
             $result = $callable($item);

            if (null === $type) {
                $type =  gettype($result);

                if ($type === 'object') {
                    $type = get_class($result);
                }
            }

            $items[] = $result;
        }

        if (null === $type) {
            $type = $this->type;
        }

        $col = new static ($type);
        $col->setItemsFromTrustedSource($items);

        return $col;
    }
{@inheritdoc}