We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0ea1adf commit 4d70a0bCopy full SHA for 4d70a0b
src/Symfony/Component/Finder/Iterator/SortableIterator.php
@@ -73,7 +73,7 @@ public function __construct(\Traversable $iterator, $sort, bool $reverseOrder =
73
} elseif (self::SORT_BY_NONE === $sort) {
74
$this->sort = $order;
75
} elseif (\is_callable($sort)) {
76
- $this->sort = $sort;
+ $this->sort = $reverseOrder ? function ($a, $b) use ($sort) { return -\call_user_func($sort, $a, $b); } : $sort;
77
} else {
78
throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
79
}
0 commit comments