| @@ 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". |
|
| @@ 885-896 (lines=12) @@ | ||
| 882 | * |
|
| 883 | * @psalm-return static<TKey,T> |
|
| 884 | */ |
|
| 885 | public function uasort($function): self |
|
| 886 | { |
|
| 887 | if (!\is_callable($function)) { |
|
| 888 | throw new \InvalidArgumentException('Passed function must be callable'); |
|
| 889 | } |
|
| 890 | ||
| 891 | $this->generatorToArray(); |
|
| 892 | ||
| 893 | \uasort($this->array, $function); |
|
| 894 | ||
| 895 | return $this; |
|
| 896 | } |
|
| 897 | ||
| 898 | /** |
|
| 899 | * Sort the entries with a user-defined comparison function and maintain key association. |
|