From 6b4275482fd46af0c5371b8c826cbc391ee215c1 Mon Sep 17 00:00:00 2001 From: ameotoko Date: Thu, 8 May 2025 22:50:22 +0200 Subject: [PATCH] check for empty paths before calling Finder in `ux:icons:lock` --- src/Icons/src/Twig/IconFinder.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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; + } } }