Skip to content

Commit

Permalink
Simplify issue sorting
Browse files Browse the repository at this point in the history
As we're on 7.4 now, we can use more concise constructs
  • Loading branch information
weirdan committed Nov 23, 2022
1 parent f846906 commit 45b49df
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions src/Psalm/IssueBuffer.php
Expand Up @@ -574,21 +574,10 @@ public static function finish(
foreach (self::$issues_data as $file_path => $file_issues) {
usort(
$file_issues,
static function (IssueData $d1, IssueData $d2): int {
if ($d1->file_path === $d2->file_path) {
if ($d1->line_from === $d2->line_from) {
if ($d1->column_from === $d2->column_from) {
return 0;
}

return $d1->column_from > $d2->column_from ? 1 : -1;
}

return $d1->line_from > $d2->line_from ? 1 : -1;
}

return $d1->file_path > $d2->file_path ? 1 : -1;
}
static fn (IssueData $d1, IssueData $d2): int =>
[$d1->file_path, $d1->line_from, $d1->column_from]
<=>
[$d2->file_path, $d2->line_from, $d2->column_from]
);
self::$issues_data[$file_path] = $file_issues;
}
Expand Down

0 comments on commit 45b49df

Please sign in to comment.