Skip to content

Commit 4a013a2

Browse files
committed
Do not prefix Command Class Name by 'App' if the prefix is 'app:'
1 parent 2ca7aea commit 4a013a2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Maker/MakeCommand.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,13 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
4343
public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator)
4444
{
4545
$commandName = trim($input->getArgument('name'));
46+
$classNameSrc = $commandName;
47+
if (0 === strpos($commandName, 'app:')) {
48+
$classNameSrc = substr($classNameSrc, 4);
49+
}
50+
4651
$commandClassNameDetails = $generator->createClassNameDetails(
47-
$commandName,
52+
$classNameSrc,
4853
'Command\\',
4954
'Command',
5055
sprintf('The "%s" command name is not valid because it would be implemented by "%s" class, which is not valid as a PHP class name (it must start with a letter or underscore, followed by any number of letters, numbers, or underscores).', $commandName, Str::asClassName($commandName, 'Command'))

0 commit comments

Comments
 (0)