From 8bb34e1b6ef9112114822327d52fdfe34ff63532 Mon Sep 17 00:00:00 2001 From: Julien Rosset Date: Wed, 30 Oct 2024 12:03:10 +0100 Subject: [PATCH] Revert "CommandCall : allow command class name as command name" This reverts commit 69418f455ff03e8849a92e2280b70b8bb649c532. --- src/CliProgram/CommandCall/CommandCall.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/CliProgram/CommandCall/CommandCall.php b/src/CliProgram/CommandCall/CommandCall.php index e09d608..93f77f2 100644 --- a/src/CliProgram/CommandCall/CommandCall.php +++ b/src/CliProgram/CommandCall/CommandCall.php @@ -25,8 +25,8 @@ class CommandCall { private Arrayy $commandArguments; /** - * @param string|class-string|Command $commandName The new command name - * @param null|Arrayy $commandArguments The command new arguments + * @param string|Command $commandName The new command name + * @param null|Arrayy $commandArguments The command new arguments */ public function __construct (string|Command $commandName, ?Arrayy $commandArguments = null) { $this->setCommandName($commandName); @@ -70,20 +70,14 @@ class CommandCall { /** * Set the command name * - * @param string|class-string|Command $commandName The new command name + * @param string|Command $commandName The new command name * * @return $this */ public function setCommandName (string|Command $commandName): self { - if ($commandName instanceof Command) { - $this->commandName = CliHelper::getCommandNameFromClass($commandName->getApplication(), $commandName::class); - } - elseif (class_exists($commandName)) { - $this->commandName = CliHelper::getCommandNameFromClass($commandName->getApplication(), $commandName); - } - else { - $this->commandName = $commandName; - } + $this->commandName = $commandName instanceof Command + ? CliHelper::getCommandNameFromClass($commandName->getApplication(), $commandName::class) + : $commandName; return $this; }