Skip to content

Commit

Permalink
Fixed issue with files being analysed multiple times when result cach…
Browse files Browse the repository at this point in the history
…e is used
  • Loading branch information
ondrejmirtes committed Mar 2, 2020
1 parent 5b764c7 commit 349bd9e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Analyser/ResultCache/ResultCacheManager.php
Expand Up @@ -119,7 +119,7 @@ public function restore(array $allAnalysedFiles, bool $debug): ResultCache
}
}

return new ResultCache($filesToAnalyse, false, $data['lastFullAnalysisTime'], $data['errors'], $invertedDependenciesToReturn);
return new ResultCache(array_unique($filesToAnalyse), false, $data['lastFullAnalysisTime'], $data['errors'], $invertedDependenciesToReturn);
}

public function process(AnalyserResult $analyserResult, ResultCache $resultCache): AnalyserResult
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/ResultCacheEndToEndTest.php
Expand Up @@ -31,6 +31,7 @@ public function testResultCache(): void
$lexerCode = str_replace('@param string $code', '', $lexerCode);
$lexerCode = str_replace('public function startLexing($code', 'public function startLexing(\\PhpParser\\Node\\Expr\\MethodCall $code', $lexerCode);
file_put_contents($lexerPath, $lexerCode);
touch(__DIR__ . '/PHP-Parser/lib/PhpParser/ErrorHandler.php');

$result = $this->runPhpstan(1);
$this->assertSame(2, $result['totals']['file_errors']);
Expand Down

0 comments on commit 349bd9e

Please sign in to comment.