| @@ 875-886 (lines=12) @@ | ||
| 872 | * |
|
| 873 | * @psalm-return static<TKey,T> |
|
| 874 | */ |
|
| 875 | public function uasort($function): self |
|
| 876 | { |
|
| 877 | if (!\is_callable($function)) { |
|
| 878 | throw new \InvalidArgumentException('Passed function must be callable'); |
|
| 879 | } |
|
| 880 | ||
| 881 | $this->generatorToArray(); |
|
| 882 | ||
| 883 | \uasort($this->array, $function); |
|
| 884 | ||
| 885 | return $this; |
|
| 886 | } |
|
| 887 | ||
| 888 | /** |
|
| 889 | * Sort the entries with a user-defined comparison function and maintain key association. |
|
| @@ 1982-1993 (lines=12) @@ | ||
| 1979 | * |
|
| 1980 | * @psalm-return static<TKey,T> |
|
| 1981 | */ |
|
| 1982 | public function customSortValues($function): self |
|
| 1983 | { |
|
| 1984 | if (\is_callable($function) === false) { |
|
| 1985 | throw new \InvalidArgumentException('Passed function must be callable'); |
|
| 1986 | } |
|
| 1987 | ||
| 1988 | $this->generatorToArray(); |
|
| 1989 | ||
| 1990 | \usort($this->array, $function); |
|
| 1991 | ||
| 1992 | return $this; |
|
| 1993 | } |
|
| 1994 | ||
| 1995 | /** |
|
| 1996 | * Custom sort by value via "usort". |
|