| @@ 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. |
|
| @@ 1940-1951 (lines=12) @@ | ||
| 1937 | * |
|
| 1938 | * @psalm-return static<TKey,T> |
|
| 1939 | */ |
|
| 1940 | public function customSortValues($function): self |
|
| 1941 | { |
|
| 1942 | if (\is_callable($function) === false) { |
|
| 1943 | throw new \InvalidArgumentException('Passed function must be callable'); |
|
| 1944 | } |
|
| 1945 | ||
| 1946 | $this->generatorToArray(); |
|
| 1947 | ||
| 1948 | \usort($this->array, $function); |
|
| 1949 | ||
| 1950 | return $this; |
|
| 1951 | } |
|
| 1952 | ||
| 1953 | /** |
|
| 1954 | * Custom sort by value via "usort". |
|