From cd2415f580c0815bc8be3822095f4acb8e43647b Mon Sep 17 00:00:00 2001 From: Marc Riemer Date: Sun, 5 Jan 2025 21:20:45 +0100 Subject: [PATCH] Fixed custom root namespace #1641 --- src/Maker/MakeTwigComponent.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Maker/MakeTwigComponent.php b/src/Maker/MakeTwigComponent.php index 4bf55ee8d..a55f34228 100644 --- a/src/Maker/MakeTwigComponent.php +++ b/src/Maker/MakeTwigComponent.php @@ -71,7 +71,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen $factory = $generator->createClassNameDetails( $name, - $this->namespace, + str_replace($generator->getRootNamespace() . "\\", "", $this->namespace), ); $templatePath = str_replace('\\', '/', $factory->getRelativeNameWithoutSuffix()); @@ -111,7 +111,7 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma try { $value = Yaml::parse($this->fileManager->getFileContents($path)); - $this->namespace = substr(array_key_first($value['twig_component']['defaults']), 4); + $this->namespace = array_key_first($value['twig_component']['defaults']); } catch (\Throwable $throwable) { throw new RuntimeCommandException(message: 'Unable to parse twig_component.yaml', previous: $throwable); }