From cac7055c9d443acb2a00b31a79dcb7ddfeabbd25 Mon Sep 17 00:00:00 2001 From: Julien Rosset Date: Wed, 26 Apr 2023 09:03:23 +0200 Subject: [PATCH] BaseCommand: default command name start with lower case --- src/CliProgram/BaseCommand.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/CliProgram/BaseCommand.php b/src/CliProgram/BaseCommand.php index 996e55b..5174d31 100644 --- a/src/CliProgram/BaseCommand.php +++ b/src/CliProgram/BaseCommand.php @@ -16,7 +16,12 @@ class BaseCommand extends Command { * @param string ...$aliases The command aliases */ public function __construct (?string $name = null, string ...$aliases) { - parent::__construct($name ?? (new ReflectionClass($this))->getShortName()); + if ($name === null) { + $classShortName = (new ReflectionClass($this))->getShortName(); + $name = mb_strtolower(mb_substr($classShortName, 0, 1)) . mb_substr($classShortName, 1); + } + + parent::__construct($name); $this->setAliases($aliases); } } \ No newline at end of file