@@ -14,9 +14,6 @@ class ResultCacheManager
1414
1515 private const CACHE_VERSION = 'v1 ' ;
1616
17- /** @var bool */
18- private $ enabled ;
19-
2017 /** @var string */
2118 private $ cacheFilePath ;
2219
@@ -36,7 +33,6 @@ class ResultCacheManager
3633 private $ usedLevel ;
3734
3835 /**
39- * @param bool $enabled
4036 * @param string $cacheFilePath
4137 * @param string[] $allCustomConfigFiles
4238 * @param string[] $analysedPaths
@@ -45,7 +41,6 @@ class ResultCacheManager
4541 * @param string $usedLevel
4642 */
4743 public function __construct (
48- bool $ enabled ,
4944 string $ cacheFilePath ,
5045 array $ allCustomConfigFiles ,
5146 array $ analysedPaths ,
@@ -54,7 +49,6 @@ public function __construct(
5449 string $ usedLevel
5550 )
5651 {
57- $ this ->enabled = $ enabled ;
5852 $ this ->cacheFilePath = $ cacheFilePath ;
5953 $ this ->allCustomConfigFiles = $ allCustomConfigFiles ;
6054 $ this ->analysedPaths = $ analysedPaths ;
@@ -70,10 +64,6 @@ public function __construct(
7064 */
7165 public function restore (array $ allAnalysedFiles , bool $ debug ): ResultCache
7266 {
73- if (!$ this ->enabled ) {
74- return new ResultCache ($ allAnalysedFiles , true , time (), [], []);
75- }
76-
7767 if ($ debug ) {
7868 return new ResultCache ($ allAnalysedFiles , true , time (), [], []);
7969 }
@@ -407,16 +397,14 @@ private function getStubFiles(): array
407397
408398 public function clear (): string
409399 {
400+ $ dir = dirname ($ this ->cacheFilePath );
410401 if (!is_file ($ this ->cacheFilePath )) {
411- return dirname ( $ this -> cacheFilePath ) ;
402+ return $ dir ;
412403 }
413404
414405 @unlink ($ this ->cacheFilePath );
415- if (is_file ($ this ->cacheFilePath )) {
416- throw new \PHPStan \ShouldNotHappenException ('File still exists. ' );
417- }
418406
419- return dirname ( $ this -> cacheFilePath ) ;
407+ return $ dir ;
420408 }
421409
422410}
0 commit comments