Skip to content

Commit 16cd93f

Browse files
committed
De-duplicate phpstan.php errors
1 parent 3be15da commit 16cd93f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Analyser/FileAnalyser.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ final class FileAnalyser
5252
/** @var list<Error> */
5353
private array $allPhpErrors = [];
5454

55-
/** @var list<Error> */
55+
/** @var array<string, Error> */
5656
private array $filteredPhpErrors = [];
5757

5858
public function __construct(
@@ -377,7 +377,8 @@ private function collectErrors(array $analysedFiles): void
377377
return true;
378378
}
379379

380-
$this->filteredPhpErrors[] = (new Error($errorMessage, $errfile, $errline, $errno === E_USER_DEPRECATED))->withIdentifier('phpstan.php');
380+
$errorSignature = hash('sha256',md5(sprintf('%s:%s::%s', $errfile, $errline, $errorMessage)));
381+
$this->filteredPhpErrors[$errorSignature] = (new Error($errorMessage, $errfile, $errline, $errno === E_USER_DEPRECATED))->withIdentifier('phpstan.php');
381382

382383
return true;
383384
});

0 commit comments

Comments
 (0)