Skip to content

Commit

Permalink
Deduplicate $internalFileSpecificErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jun 24, 2024
1 parent 4f75ba6 commit 9967f48
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Command/AnalyseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

if (!$hasStackTrace) {
$internalFileSpecificErrors[] = $fileSpecificError;
if (!array_key_exists($fileSpecificError->getMessage(), $internalFileSpecificErrors)) {
$internalFileSpecificErrors[$fileSpecificError->getMessage()] = $fileSpecificError;
}
}

$internalErrorsTuples[$fileSpecificError->getMessage()] = [new InternalError(
Expand Down Expand Up @@ -442,7 +444,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

if (count($internalErrorsTuples) > 0) {
$analysisResult = new AnalysisResult(
$internalFileSpecificErrors,
array_values($internalFileSpecificErrors),
array_map(static fn (InternalError $internalError) => $internalError->getMessage(), $internalErrors),
[],
[],
Expand Down

0 comments on commit 9967f48

Please sign in to comment.