diff --git a/src/Discord/Helpers/CollectionInterface.php b/src/Discord/Helpers/CollectionInterface.php index 9395aec5a..c0265d695 100644 --- a/src/Discord/Helpers/CollectionInterface.php +++ b/src/Discord/Helpers/CollectionInterface.php @@ -33,6 +33,7 @@ public function has(...$keys): bool; public function filter(callable $callback); public function find(callable $callback); public function clear(): void; + public function usort(callable $callback): true; public function map(callable $callback); public function merge($collection): self; public function toArray(); diff --git a/src/Discord/Helpers/CollectionTrait.php b/src/Discord/Helpers/CollectionTrait.php index 3ca091a9c..4de06cbc4 100644 --- a/src/Discord/Helpers/CollectionTrait.php +++ b/src/Discord/Helpers/CollectionTrait.php @@ -295,6 +295,11 @@ public function clear(): void $this->items = []; } + public function usort(callable $callback): true + { + return usort($this->items, $callback); + } + /** * Runs a callback over the collection and creates a new static. *