From 68cc7a67b9d72ec85d180c4fbcb7ae896d3c137a Mon Sep 17 00:00:00 2001 From: Julien Rosset Date: Tue, 6 Oct 2026 18:10:00 +0200 Subject: [PATCH] Fix CommandArgumentList::copySymfonyOptionsOf --- .../CommandCall/CommandArgumentList.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/CliProgram/CommandCall/CommandArgumentList.php b/src/CliProgram/CommandCall/CommandArgumentList.php index 186a15a..50c7ce3 100644 --- a/src/CliProgram/CommandCall/CommandArgumentList.php +++ b/src/CliProgram/CommandCall/CommandArgumentList.php @@ -94,19 +94,16 @@ class CommandArgumentList { public function copySymfonyOptionsOf (InputInterface $input): static { $this->copyVerbosityOptionOf($input); foreach ($input->getOptions() as $optionName => $optionValue) { - if (in_array($optionName, self::SYMFONY_OPTIONS_BOOL) && $optionValue === false) { - // Symfony se contente de regarder si le nom de l'option est donné, peu importe sa valeur, donc ils ne sont pas recopiés si à faux - continue; - } - elseif (in_array($optionName, self::SYMFONY_OPTIONS_TEXT) && $optionValue === null) { - // Symfony se contente de regarder si le nom de l'option est donné, peu importe sa valeur, donc n'est pas recopié si aucune valeur - continue; - } - elseif ($optionName == self::SYMFONY_OPTION_VERBOSITY) { + if ($optionName == self::SYMFONY_OPTION_VERBOSITY) { // Déjà géré via $this->copyVerbosityOptionOf continue; } - $this->addOption($optionName, $optionValue); + + if ((in_array($optionName, self::SYMFONY_OPTIONS_BOOL) && $optionValue !== false) + || (in_array($optionName, self::SYMFONY_OPTIONS_TEXT) && $optionValue !== null) + ) { + $this->addOption($optionName, $optionValue); + } } return $this; }