| @@ 882-893 (lines=12) @@ | ||
| 879 | * |
|
| 880 | * @psalm-return static<TKey,T> |
|
| 881 | */ |
|
| 882 | public function uasort($function): self |
|
| 883 | { |
|
| 884 | if (!\is_callable($function)) { |
|
| 885 | throw new \InvalidArgumentException('Passed function must be callable'); |
|
| 886 | } |
|
| 887 | ||
| 888 | $this->generatorToArray(); |
|
| 889 | ||
| 890 | \uasort($this->array, $function); |
|
| 891 | ||
| 892 | return $this; |
|
| 893 | } |
|
| 894 | ||
| 895 | /** |
|
| 896 | * Sort the entries with a user-defined comparison function and maintain key association. |
|
| @@ 1993-2004 (lines=12) @@ | ||
| 1990 | * |
|
| 1991 | * @psalm-return static<TKey,T> |
|
| 1992 | */ |
|
| 1993 | public function customSortValues($function): self |
|
| 1994 | { |
|
| 1995 | if (\is_callable($function) === false) { |
|
| 1996 | throw new \InvalidArgumentException('Passed function must be callable'); |
|
| 1997 | } |
|
| 1998 | ||
| 1999 | $this->generatorToArray(); |
|
| 2000 | ||
| 2001 | \usort($this->array, $function); |
|
| 2002 | ||
| 2003 | return $this; |
|
| 2004 | } |
|
| 2005 | ||
| 2006 | /** |
|
| 2007 | * Custom sort by value via "usort". |
|