/** * {@inheritDoc} */ public function findFile($class) { static $isAllowedFilter = null, $isProduction = false; if (!$isAllowedFilter) { $isAllowedFilter = $this->fileEnumerator->getFilter(); $isProduction = !$this->options['debug']; } $file = $this->original->findFile($class); if ($file) { $cacheState = isset($this->cacheState[$file]) ? $this->cacheState[$file] : null; if ($cacheState && $isProduction) { $file = $cacheState['cacheUri'] ?: $file; } elseif ($isAllowedFilter(new \SplFileInfo($file))) { // can be optimized here with $cacheState even for debug mode, but no needed right now $file = FilterInjectorTransformer::rewrite($file); } } return $file; }