src/Bag.php
public function mapKeys(callable $callback)
    {
        $items = [];

        foreach ($this->items as $key => $value) {
            $items[$callback($key, $value)] = $value;
        }

        return $this->createFrom($items);
    }
public function mapKeys(callable $callback)
    {
        $items = [];

        foreach ($this->items as $key => $value) {
            $items[$callback($key, $value)] = $value;
        }

        return $this->createFrom($items);
    }
Applies the given function to each _key_ in the bag and returns
a new bag with the keys returned by the function and their values.

@param callable $callback Function is passed `($key, $value)`

@return static