Skip to content

Commit

Permalink
[5.3] Replace manual comparator with basic asort (#14980)
Browse files Browse the repository at this point in the history
* Replace manual comparator with basic asort

* Remove trailing space
  • Loading branch information
rtheunissen authored and taylorotwell committed Aug 24, 2016
1 parent 69e5b7e commit 7598906
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Illuminate/Support/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -947,13 +947,9 @@ public function sort(callable $callback = null)
{
$items = $this->items;

$callback ? uasort($items, $callback) : uasort($items, function ($a, $b) {
if ($a == $b) {
return 0;
}

return ($a < $b) ? -1 : 1;
});
$callback
? uasort($items, $callback)
: asort($items);

return new static($items);
}
Expand Down

0 comments on commit 7598906

Please sign in to comment.