From 5846317f780822cb47659bc06924120d52a301eb Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Thu, 24 Aug 2023 15:26:58 +0200 Subject: [PATCH] Fix --- .../SourceLocator/OptimizedDirectorySourceLocatorFactory.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorFactory.php b/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorFactory.php index ab7217b162..4d2a9e76a3 100644 --- a/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorFactory.php +++ b/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorFactory.php @@ -46,6 +46,8 @@ public function createByDirectory(string $directory): OptimizedDirectorySourceLo $cacheKey = sprintf('odsl-%s', $directory); $variableCacheKey = 'v1'; + + /** @var array|null $cached */ $cached = $this->cache->load($cacheKey, $variableCacheKey); if ($cached !== null) { foreach ($cached as $file => [$hash, $classes, $functions, $constants]) { @@ -62,6 +64,8 @@ public function createByDirectory(string $directory): OptimizedDirectorySourceLo [$newClasses, $newFunctions, $newConstants] = $this->findSymbols($file); $cached[$file] = [$newHash, $newClasses, $newFunctions, $newConstants]; } + } else { + $cached = []; } foreach ($fileHashes as $file => $newHash) {