| @@ 890-901 (lines=12) @@ | ||
| 887 | * |
|
| 888 | * @psalm-return static<TKey,T> |
|
| 889 | */ |
|
| 890 | public function uasort($function): self |
|
| 891 | { |
|
| 892 | if (!\is_callable($function)) { |
|
| 893 | throw new \InvalidArgumentException('Passed function must be callable'); |
|
| 894 | } |
|
| 895 | ||
| 896 | $this->generatorToArray(); |
|
| 897 | ||
| 898 | \uasort($this->array, $function); |
|
| 899 | ||
| 900 | return $this; |
|
| 901 | } |
|
| 902 | ||
| 903 | /** |
|
| 904 | * Sort the entries with a user-defined comparison function and maintain key association. |
|
| @@ 2001-2012 (lines=12) @@ | ||
| 1998 | * |
|
| 1999 | * @psalm-return static<TKey,T> |
|
| 2000 | */ |
|
| 2001 | public function customSortValues($function): self |
|
| 2002 | { |
|
| 2003 | if (\is_callable($function) === false) { |
|
| 2004 | throw new \InvalidArgumentException('Passed function must be callable'); |
|
| 2005 | } |
|
| 2006 | ||
| 2007 | $this->generatorToArray(); |
|
| 2008 | ||
| 2009 | \usort($this->array, $function); |
|
| 2010 | ||
| 2011 | return $this; |
|
| 2012 | } |
|
| 2013 | ||
| 2014 | /** |
|
| 2015 | * Custom sort by value via "usort". |
|