Skip to content

Commit c22e620

Browse files
committed
Delete result cache file when it fails to load
1 parent 468b6d2 commit c22e620

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/Analyser/ResultCache/ResultCacheManager.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
119119
if ($output->isDebug()) {
120120
$output->writeLineFormatted(sprintf('Result cache not used because an error occurred while loading the cache file: %s', $e->getMessage()));
121121
}
122+
123+
@unlink($cacheFilePath);
124+
122125
return new ResultCache($allAnalysedFiles, true, time(), [], [], []);
123126
}
124127

@@ -127,6 +130,7 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
127130
if ($output->isDebug()) {
128131
$output->writeLineFormatted('Result cache not used because the cache file is corrupted.');
129132
}
133+
130134
return new ResultCache($allAnalysedFiles, true, time(), [], [], []);
131135
}
132136

0 commit comments

Comments
 (0)