| @@ 870-881 (lines=12) @@ | ||
| 867 | * |
|
| 868 | * @psalm-return static<TKey,T> |
|
| 869 | */ |
|
| 870 | public function uasort($function): self |
|
| 871 | { |
|
| 872 | if (!\is_callable($function)) { |
|
| 873 | throw new \InvalidArgumentException('Passed function must be callable'); |
|
| 874 | } |
|
| 875 | ||
| 876 | $this->generatorToArray(); |
|
| 877 | ||
| 878 | \uasort($this->array, $function); |
|
| 879 | ||
| 880 | return $this; |
|
| 881 | } |
|
| 882 | ||
| 883 | /** |
|
| 884 | * Sort the entries with a user-defined comparison function and maintain key association. |
|
| @@ 1923-1934 (lines=12) @@ | ||
| 1920 | * |
|
| 1921 | * @psalm-return static<TKey,T> |
|
| 1922 | */ |
|
| 1923 | public function customSortValues($function): self |
|
| 1924 | { |
|
| 1925 | if (\is_callable($function) === false) { |
|
| 1926 | throw new \InvalidArgumentException('Passed function must be callable'); |
|
| 1927 | } |
|
| 1928 | ||
| 1929 | $this->generatorToArray(); |
|
| 1930 | ||
| 1931 | \usort($this->array, $function); |
|
| 1932 | ||
| 1933 | return $this; |
|
| 1934 | } |
|
| 1935 | ||
| 1936 | /** |
|
| 1937 | * Custom sort by value via "usort". |
|