Skip to content

Commit ca8b0b6

Browse files
committed
Make the sort on score more readable
1 parent c1be2fd commit ca8b0b6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Widget/RegionService.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ public function getAutocompletResults($searchString, $language = 'nl')
125125
uasort(
126126
$matches,
127127
function ($a, $b) {
128-
// Reverse the result using *-1 so higher scores are sorted before lower scores (instead of after)
129-
return ($a['score'] <=> $b['score']) * -1;
128+
// Reverse the comparison so that matches with a higher score are sorted before matches with a lower
129+
// score
130+
return $b['score'] <=> $a['score'];
130131
}
131132
);
132133

0 commit comments

Comments
 (0)