Skip to content

Commit 495b7d6

Browse files
committed
bug #1642 Custom root namespace make:twig-component (marcriemer)
This PR was squashed before being merged into the 1.x-dev branch. Discussion ---------- Custom root namespace make:twig-component Fixed #1641 Commits ------- 708eb83 Custom root namespace make:twig-component
2 parents 2237542 + 708eb83 commit 495b7d6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Maker/MakeTwigComponent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
7171

7272
$factory = $generator->createClassNameDetails(
7373
$name,
74-
$this->namespace,
74+
str_replace($generator->getRootNamespace().'\\', '', $this->namespace),
7575
);
7676

7777
$templatePath = str_replace('\\', '/', $factory->getRelativeNameWithoutSuffix());
@@ -111,7 +111,7 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
111111

112112
try {
113113
$value = Yaml::parse($this->fileManager->getFileContents($path));
114-
$this->namespace = substr(array_key_first($value['twig_component']['defaults']), 4);
114+
$this->namespace = array_key_first($value['twig_component']['defaults']);
115115
} catch (\Throwable $throwable) {
116116
throw new RuntimeCommandException(message: 'Unable to parse twig_component.yaml', previous: $throwable);
117117
}

0 commit comments

Comments
 (0)