Skip to content

Commit 5f79dce

Browse files
committed
Few more cases
1 parent a5744d0 commit 5f79dce

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/Analyser/ResultCache/ResultCacheManager.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,21 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
9292
{
9393
$startTime = microtime(true);
9494
if ($debug) {
95-
if ($output->isDebug()) {
95+
if ($output->isVerbose()) {
9696
$output->writeLineFormatted('Result cache not used because of debug mode.');
9797
}
9898
return new ResultCache($allAnalysedFiles, true, time(), $this->getMeta($allAnalysedFiles, $projectConfigArray), [], [], [], [], [], [], [], []);
9999
}
100100
if ($onlyFiles) {
101-
if ($output->isDebug()) {
101+
if ($output->isVerbose()) {
102102
$output->writeLineFormatted('Result cache not used because only files were passed as analysed paths.');
103103
}
104104
return new ResultCache($allAnalysedFiles, true, time(), $this->getMeta($allAnalysedFiles, $projectConfigArray), [], [], [], [], [], [], [], []);
105105
}
106106

107107
$cacheFilePath = $this->cacheFilePath;
108108
if (!is_file($cacheFilePath)) {
109-
if ($output->isDebug()) {
109+
if ($output->isVerbose()) {
110110
$output->writeLineFormatted('Result cache not used because the cache file does not exist.');
111111
}
112112
return new ResultCache($allAnalysedFiles, true, time(), $this->getMeta($allAnalysedFiles, $projectConfigArray), [], [], [], [], [], [], [], []);
@@ -115,7 +115,7 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
115115
try {
116116
$data = require $cacheFilePath;
117117
} catch (Throwable $e) {
118-
if ($output->isDebug()) {
118+
if ($output->isVerbose()) {
119119
$output->writeLineFormatted(sprintf('Result cache not used because an error occurred while loading the cache file: %s', $e->getMessage()));
120120
}
121121

@@ -126,7 +126,7 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
126126

127127
if (!is_array($data)) {
128128
@unlink($cacheFilePath);
129-
if ($output->isDebug()) {
129+
if ($output->isVerbose()) {
130130
$output->writeLineFormatted('Result cache not used because the cache file is corrupted.');
131131
}
132132

@@ -135,15 +135,15 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
135135

136136
$meta = $this->getMeta($allAnalysedFiles, $projectConfigArray);
137137
if ($this->isMetaDifferent($data['meta'], $meta)) {
138-
if ($output->isDebug()) {
138+
if ($output->isVerbose()) {
139139
$diffs = $this->getMetaKeyDifferences($data['meta'], $meta);
140140
$output->writeLineFormatted('Result cache not used because the metadata do not match: ' . implode(', ', $diffs));
141141
}
142142
return new ResultCache($allAnalysedFiles, true, time(), $meta, [], [], [], [], [], [], [], []);
143143
}
144144

145145
if (time() - $data['lastFullAnalysisTime'] >= 60 * 60 * 24 * 7) {
146-
if ($output->isDebug()) {
146+
if ($output->isVerbose()) {
147147
$output->writeLineFormatted('Result cache not used because it\'s more than 7 days since last full analysis.');
148148
}
149149
// run full analysis if the result cache is older than 7 days
@@ -159,7 +159,7 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
159159
continue;
160160
}
161161
if (!is_file($extensionFile)) {
162-
if ($output->isDebug()) {
162+
if ($output->isVerbose()) {
163163
$output->writeLineFormatted(sprintf('Result cache not used because extension file %s was not found.', $extensionFile));
164164
}
165165
return new ResultCache($allAnalysedFiles, true, time(), $meta, [], [], [], [], [], [], [], []);
@@ -169,7 +169,7 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
169169
continue;
170170
}
171171

172-
if ($output->isDebug()) {
172+
if ($output->isVerbose()) {
173173
$output->writeLineFormatted(sprintf('Result cache not used because extension file %s hash does not match.', $extensionFile));
174174
}
175175

@@ -287,7 +287,7 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
287287
$filesToAnalyse = array_unique($filesToAnalyse);
288288
$filesToAnalyseCount = count($filesToAnalyse);
289289

290-
if ($output->isDebug()) {
290+
if ($output->isVerbose()) {
291291
$elapsed = microtime(true) - $startTime;
292292
$elapsedString = $elapsed > 5
293293
? sprintf(' in %f seconds', round($elapsed, 1))

0 commit comments

Comments
 (0)