[Finder] fix reverse sorting custom-ordering functions
This commit is contained in:
parent
0ea1adf3cc
commit
4d70a0b7d4
@ -73,7 +73,7 @@ class SortableIterator implements \IteratorAggregate
|
||||
} elseif (self::SORT_BY_NONE === $sort) {
|
||||
$this->sort = $order;
|
||||
} elseif (\is_callable($sort)) {
|
||||
$this->sort = $sort;
|
||||
$this->sort = $reverseOrder ? function ($a, $b) use ($sort) { return -\call_user_func($sort, $a, $b); } : $sort;
|
||||
} else {
|
||||
throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
|
||||
}
|
||||
|
Reference in New Issue
Block a user