| @@ 895-906 (lines=12) @@ | ||
| 892 | * |
|
| 893 | * @psalm-return static<TKey,T> |
|
| 894 | */ |
|
| 895 | public function uasort($function): self |
|
| 896 | { |
|
| 897 | if (!\is_callable($function)) { |
|
| 898 | throw new \InvalidArgumentException('Passed function must be callable'); |
|
| 899 | } |
|
| 900 | ||
| 901 | $this->generatorToArray(); |
|
| 902 | ||
| 903 | \uasort($this->array, $function); |
|
| 904 | ||
| 905 | return $this; |
|
| 906 | } |
|
| 907 | ||
| 908 | /** |
|
| 909 | * Sort the entries with a user-defined comparison function and maintain key association. |
|
| @@ 2024-2035 (lines=12) @@ | ||
| 2021 | * |
|
| 2022 | * @psalm-return static<TKey,T> |
|
| 2023 | */ |
|
| 2024 | public function customSortValues($function): self |
|
| 2025 | { |
|
| 2026 | if (\is_callable($function) === false) { |
|
| 2027 | throw new \InvalidArgumentException('Passed function must be callable'); |
|
| 2028 | } |
|
| 2029 | ||
| 2030 | $this->generatorToArray(); |
|
| 2031 | ||
| 2032 | \usort($this->array, $function); |
|
| 2033 | ||
| 2034 | return $this; |
|
| 2035 | } |
|
| 2036 | ||
| 2037 | /** |
|
| 2038 | * Custom sort by value via "usort". |
|