src/Bag.php
public function sortKeysWith(callable $comparator)
    {
        $items = $this->items;

        uksort($items, $comparator);

        return $this->createFrom($items);
    }
public function sortKeysWith(callable $comparator)
    {
        $items = $this->items;

        uksort($items, $comparator);

        return $this->createFrom($items);
    }
Returns a bag with the keys sorted with the `$comparator`.

@param callable $comparator Function given `($keyA, $keyB)`

@return static