src/Utils/Utils.php
public static function map($traversable, callable $fn)
    {
        self::invariant(
            is_array($traversable) || $traversable instanceof Traversable,
            __METHOD__ . ' expects array or Traversable'
        );

        $map = [];
        foreach ($traversable as $key => $value) {
            $map[$key] = $fn($value, $key);
        }

        return $map;
    }
public static function map($traversable, callable $fn)
    {
        self::invariant(
            is_array($traversable) || $traversable instanceof Traversable,
            __METHOD__ . ' expects array or Traversable'
        );

        $map = [];
        foreach ($traversable as $key => $value) {
            $map[$key] = $fn($value, $key);
        }

        return $map;
    }
@param mixed|Traversable $traversable

@return mixed[]

@throws Exception