Skip to content

Commit 90b1048

Browse files
committed
Fix PHPStan Pro flickering
It was caused by some files being iterated over multiple times, resulting in them always being reported as new.
1 parent 2d09553 commit 90b1048

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/File/FileMonitor.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function initialize(array $filePaths): void
4646
{
4747
$finderResult = $this->analyseFileFinder->findFiles($this->analysedPaths);
4848
$fileHashes = [];
49-
foreach (array_merge($finderResult->getFiles(), $filePaths, $this->getScannedFiles($finderResult->getFiles())) as $filePath) {
49+
foreach (array_unique(array_merge($finderResult->getFiles(), $filePaths, $this->getScannedFiles($finderResult->getFiles()))) as $filePath) {
5050
$fileHashes[$filePath] = $this->getFileHash($filePath);
5151
}
5252

@@ -65,7 +65,8 @@ public function getChanges(): FileMonitorResult
6565
$newFiles = [];
6666
$changedFiles = [];
6767
$deletedFiles = [];
68-
foreach (array_merge($finderResult->getFiles(), $this->filePaths, $this->getScannedFiles($finderResult->getFiles())) as $filePath) {
68+
$filePaths = array_unique(array_merge($finderResult->getFiles(), $this->filePaths, $this->getScannedFiles($finderResult->getFiles())));
69+
foreach ($filePaths as $filePath) {
6970
if (!array_key_exists($filePath, $oldFileHashes)) {
7071
$newFiles[] = $filePath;
7172
$fileHashes[$filePath] = $this->getFileHash($filePath);

0 commit comments

Comments
 (0)