From 7a27019d83c2d41926e9d20ed4ea6014a5b1b1ee Mon Sep 17 00:00:00 2001 From: Julien Rosset Date: Tue, 25 Apr 2023 18:34:15 +0200 Subject: [PATCH] =?UTF-8?q?BaseCommand:=20the=20name=20can=20now=20be=20nu?= =?UTF-8?q?ll=20=E2=86=92=20class=20name=20by=20default?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/CliProgram/BaseCommand.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/CliProgram/BaseCommand.php b/src/CliProgram/BaseCommand.php index cd8116f..0d8f7ee 100644 --- a/src/CliProgram/BaseCommand.php +++ b/src/CliProgram/BaseCommand.php @@ -11,11 +11,11 @@ class BaseCommand extends Command { /** * Initialize the command * - * @param string $name The command name - * @param string ...$aliases The command aliases + * @param string|null $name The command name, Null = class name + * @param string ...$aliases The command aliases */ - public function __construct (string $name, string ...$aliases) { - parent::__construct($name); + public function __construct (?string $name = null, string ...$aliases) { + parent::__construct($name ?? get_class($this)); $this->setAliases($aliases); } } \ No newline at end of file