Skip to content

Commit 978f7d0

Browse files
committed
fix
1 parent 27e88c3 commit 978f7d0

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/Analyser/FileAnalyser.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
final class FileAnalyser
5050
{
5151

52-
/** @var list<Error> */
52+
/** @var array<string, Error> */
5353
private array $allPhpErrors = [];
5454

5555
/** @var array<string, Error> */
@@ -326,8 +326,8 @@ public function analyseFile(
326326

327327
return new FileAnalyserResult(
328328
$fileErrors,
329-
$this->filteredPhpErrors,
330-
$this->allPhpErrors,
329+
array_values($this->filteredPhpErrors),
330+
array_values($this->allPhpErrors),
331331
$locallyIgnoredErrors,
332332
$fileCollectedData,
333333
array_values(array_unique($fileDependencies)),
@@ -367,7 +367,8 @@ private function collectErrors(array $analysedFiles): void
367367

368368
$errorMessage = sprintf('%s: %s', $this->getErrorLabel($errno), $errstr);
369369

370-
$this->allPhpErrors[] = (new Error($errorMessage, $errfile, $errline, false))->withIdentifier('phpstan.php');
370+
$errorSignature = hash('sha256',md5(sprintf('%s:%s::%s', $errfile, $errline, $errorMessage)));
371+
$this->allPhpErrors[$errorSignature] = (new Error($errorMessage, $errfile, $errline, false))->withIdentifier('phpstan.php');
371372

372373
if ($errno === E_DEPRECATED) {
373374
return true;

tests/PHPStan/Analyser/Bug13813IntegrationTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public function testBug13813(): void
2727

2828
/**
2929
* @param string[] $files
30-
* @return Error[]
3130
*/
3231
private function runAnalyse(array $files): AnalyserResult
3332
{

tests/PHPStan/Analyser/Bug13813Rule.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public function getNodeType(): string
2020
public function processNode(Node $node, Scope $scope): array
2121
{
2222
for ($i = 0; $i < 100; $i++) {
23+
// @phpstan-ignore variable.undefined
2324
echo $x; // force emit a PHP warning at runtime
2425
}
2526

0 commit comments

Comments
 (0)