diff --git a/src/Discover.php b/src/Discover.php index 8737a6c..45bec6c 100644 --- a/src/Discover.php +++ b/src/Discover.php @@ -142,11 +142,13 @@ public function useReflection(?string $basePath = null, ?string $rootNamespace = /** @return array|array */ public function get(): array { - if ($this->config->shouldUseCache() && $this->config->cacheDriver->has($this->config->cacheId)) { - return $this->config->cacheDriver->get($this->config->cacheId); + if (! $this->config->shouldUseCache()) { + return $this->getWithoutCache(); } - return $this->getWithoutCache(); + return $this->config->cacheDriver->has($this->config->cacheId) + ? $this->config->cacheDriver->get($this->config->cacheId) + : $this->cache(); } /** @return array|array */