Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify issue sorting #8736

Merged
merged 2 commits into from Nov 23, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 =>
weirdan marked this conversation as resolved.
Show resolved Hide resolved
[$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