Skip to content

Commit 020c048

Browse files
committed
minor #205 Do not prefix Command Class Name by 'App' if the prefix is 'app:' (lyrixx, javiereguiluz)
This PR was merged into the 1.0-dev branch. Discussion ---------- Do not prefix Command Class Name by 'App' if the prefix is 'app:' Commits ------- faa3923 Minor code refactor 4a013a2 Do not prefix Command Class Name by 'App' if the prefix is 'app:'
2 parents d49200d + faa3923 commit 020c048

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Maker/MakeCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ 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+
$commandNameHasAppPrefix = 0 === strpos($commandName, 'app:');
47+
4648
$commandClassNameDetails = $generator->createClassNameDetails(
47-
$commandName,
49+
$commandNameHasAppPrefix ? substr($commandName, 4) : $commandName,
4850
'Command\\',
4951
'Command',
5052
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)