diff --git a/src/Icons/src/Twig/IconFinder.php b/src/Icons/src/Twig/IconFinder.php index 0d8fd48fd73..a2b6844221d 100644 --- a/src/Icons/src/Twig/IconFinder.php +++ b/src/Icons/src/Twig/IconFinder.php @@ -67,12 +67,14 @@ public function icons(): array private function templateFiles(LoaderInterface $loader): iterable { if ($loader instanceof FilesystemLoader) { - $paths = []; + $paths = $loader->getPaths(); foreach ($loader->getNamespaces() as $namespace) { $paths = [...$paths, ...$loader->getPaths($namespace)]; } - foreach ((new Finder())->files()->in($paths)->name('*.twig') as $file) { - yield (string) $file; + if ($paths) { + foreach ((new Finder())->files()->in($paths)->name('*.twig') as $file) { + yield (string) $file; + } } }