@@ -92,21 +92,21 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
92
92
{
93
93
$ startTime = microtime (true );
94
94
if ($ debug ) {
95
- if ($ output ->isDebug ()) {
95
+ if ($ output ->isVeryVerbose ()) {
96
96
$ output ->writeLineFormatted ('Result cache not used because of debug mode. ' );
97
97
}
98
98
return new ResultCache ($ allAnalysedFiles , true , time (), $ this ->getMeta ($ allAnalysedFiles , $ projectConfigArray ), [], [], [], [], [], [], [], []);
99
99
}
100
100
if ($ onlyFiles ) {
101
- if ($ output ->isDebug ()) {
101
+ if ($ output ->isVeryVerbose ()) {
102
102
$ output ->writeLineFormatted ('Result cache not used because only files were passed as analysed paths. ' );
103
103
}
104
104
return new ResultCache ($ allAnalysedFiles , true , time (), $ this ->getMeta ($ allAnalysedFiles , $ projectConfigArray ), [], [], [], [], [], [], [], []);
105
105
}
106
106
107
107
$ cacheFilePath = $ this ->cacheFilePath ;
108
108
if (!is_file ($ cacheFilePath )) {
109
- if ($ output ->isDebug ()) {
109
+ if ($ output ->isVeryVerbose ()) {
110
110
$ output ->writeLineFormatted ('Result cache not used because the cache file does not exist. ' );
111
111
}
112
112
return new ResultCache ($ allAnalysedFiles , true , time (), $ this ->getMeta ($ allAnalysedFiles , $ projectConfigArray ), [], [], [], [], [], [], [], []);
@@ -115,7 +115,7 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
115
115
try {
116
116
$ data = require $ cacheFilePath ;
117
117
} catch (Throwable $ e ) {
118
- if ($ output ->isDebug ()) {
118
+ if ($ output ->isVeryVerbose ()) {
119
119
$ output ->writeLineFormatted (sprintf ('Result cache not used because an error occurred while loading the cache file: %s ' , $ e ->getMessage ()));
120
120
}
121
121
@@ -126,7 +126,7 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
126
126
127
127
if (!is_array ($ data )) {
128
128
@unlink ($ cacheFilePath );
129
- if ($ output ->isDebug ()) {
129
+ if ($ output ->isVeryVerbose ()) {
130
130
$ output ->writeLineFormatted ('Result cache not used because the cache file is corrupted. ' );
131
131
}
132
132
@@ -135,15 +135,15 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
135
135
136
136
$ meta = $ this ->getMeta ($ allAnalysedFiles , $ projectConfigArray );
137
137
if ($ this ->isMetaDifferent ($ data ['meta ' ], $ meta )) {
138
- if ($ output ->isDebug ()) {
138
+ if ($ output ->isVeryVerbose ()) {
139
139
$ diffs = $ this ->getMetaKeyDifferences ($ data ['meta ' ], $ meta );
140
140
$ output ->writeLineFormatted ('Result cache not used because the metadata do not match: ' . implode (', ' , $ diffs ));
141
141
}
142
142
return new ResultCache ($ allAnalysedFiles , true , time (), $ meta , [], [], [], [], [], [], [], []);
143
143
}
144
144
145
145
if (time () - $ data ['lastFullAnalysisTime ' ] >= 60 * 60 * 24 * 7 ) {
146
- if ($ output ->isDebug ()) {
146
+ if ($ output ->isVeryVerbose ()) {
147
147
$ output ->writeLineFormatted ('Result cache not used because it \'s more than 7 days since last full analysis. ' );
148
148
}
149
149
// 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, ?
159
159
continue ;
160
160
}
161
161
if (!is_file ($ extensionFile )) {
162
- if ($ output ->isDebug ()) {
162
+ if ($ output ->isVeryVerbose ()) {
163
163
$ output ->writeLineFormatted (sprintf ('Result cache not used because extension file %s was not found. ' , $ extensionFile ));
164
164
}
165
165
return new ResultCache ($ allAnalysedFiles , true , time (), $ meta , [], [], [], [], [], [], [], []);
@@ -169,7 +169,7 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
169
169
continue ;
170
170
}
171
171
172
- if ($ output ->isDebug ()) {
172
+ if ($ output ->isVeryVerbose ()) {
173
173
$ output ->writeLineFormatted (sprintf ('Result cache not used because extension file %s hash does not match. ' , $ extensionFile ));
174
174
}
175
175
@@ -287,7 +287,7 @@ public function restore(array $allAnalysedFiles, bool $debug, bool $onlyFiles, ?
287
287
$ filesToAnalyse = array_unique ($ filesToAnalyse );
288
288
$ filesToAnalyseCount = count ($ filesToAnalyse );
289
289
290
- if ($ output ->isDebug ()) {
290
+ if ($ output ->isVeryVerbose ()) {
291
291
$ elapsed = microtime (true ) - $ startTime ;
292
292
$ elapsedString = $ elapsed > 5
293
293
? sprintf (' in %f seconds ' , round ($ elapsed , 1 ))
@@ -412,20 +412,20 @@ public function process(AnalyserResult $analyserResult, ResultCache $resultCache
412
412
}
413
413
$ doSave = function (array $ errorsByFile , $ locallyIgnoredErrorsByFile , $ linesToIgnore , $ unmatchedLineIgnores , $ collectedDataByFile , ?array $ dependencies , array $ exportedNodes , array $ projectExtensionFiles ) use ($ internalErrors , $ resultCache , $ output , $ onlyFiles , $ meta ): bool {
414
414
if ($ onlyFiles ) {
415
- if ($ output ->isDebug ()) {
415
+ if ($ output ->isVeryVerbose ()) {
416
416
$ output ->writeLineFormatted ('Result cache was not saved because only files were passed as analysed paths. ' );
417
417
}
418
418
return false ;
419
419
}
420
420
if ($ dependencies === null ) {
421
- if ($ output ->isDebug ()) {
421
+ if ($ output ->isVeryVerbose ()) {
422
422
$ output ->writeLineFormatted ('Result cache was not saved because of error in dependencies. ' );
423
423
}
424
424
return false ;
425
425
}
426
426
427
427
if (count ($ internalErrors ) > 0 ) {
428
- if ($ output ->isDebug ()) {
428
+ if ($ output ->isVeryVerbose ()) {
429
429
$ output ->writeLineFormatted ('Result cache was not saved because of internal errors. ' );
430
430
}
431
431
return false ;
@@ -437,7 +437,7 @@ public function process(AnalyserResult $analyserResult, ResultCache $resultCache
437
437
continue ;
438
438
}
439
439
440
- if ($ output ->isDebug ()) {
440
+ if ($ output ->isVeryVerbose ()) {
441
441
$ output ->writeLineFormatted (sprintf ('Result cache was not saved because of non-ignorable exception: %s ' , $ error ->getMessage ()));
442
442
}
443
443
@@ -447,7 +447,7 @@ public function process(AnalyserResult $analyserResult, ResultCache $resultCache
447
447
448
448
$ this ->save ($ resultCache ->getLastFullAnalysisTime (), $ errorsByFile , $ locallyIgnoredErrorsByFile , $ linesToIgnore , $ unmatchedLineIgnores , $ collectedDataByFile , $ dependencies , $ exportedNodes , $ projectExtensionFiles , $ meta );
449
449
450
- if ($ output ->isDebug ()) {
450
+ if ($ output ->isVeryVerbose ()) {
451
451
$ output ->writeLineFormatted ('Result cache is saved. ' );
452
452
}
453
453
@@ -463,7 +463,7 @@ public function process(AnalyserResult $analyserResult, ResultCache $resultCache
463
463
}
464
464
$ saved = $ doSave ($ freshErrorsByFile , $ freshLocallyIgnoredErrorsByFile , $ analyserResult ->getLinesToIgnore (), $ analyserResult ->getUnmatchedLineIgnores (), $ freshCollectedDataByFile , $ analyserResult ->getDependencies (), $ analyserResult ->getExportedNodes (), $ projectExtensionFiles );
465
465
} else {
466
- if ($ output ->isDebug ()) {
466
+ if ($ output ->isVeryVerbose ()) {
467
467
$ output ->writeLineFormatted ('Result cache was not saved because it was not requested. ' );
468
468
}
469
469
}
0 commit comments