Fix CommandArgumentList::copySymfonyOptionsOf

master 3.19.2
Julien Rosset 3 weeks ago
parent 699851954e
commit 68cc7a67b9

@ -94,20 +94,17 @@ class CommandArgumentList {
public function copySymfonyOptionsOf (InputInterface $input): static { public function copySymfonyOptionsOf (InputInterface $input): static {
$this->copyVerbosityOptionOf($input); $this->copyVerbosityOptionOf($input);
foreach ($input->getOptions() as $optionName => $optionValue) { foreach ($input->getOptions() as $optionName => $optionValue) {
if (in_array($optionName, self::SYMFONY_OPTIONS_BOOL) && $optionValue === false) { if ($optionName == self::SYMFONY_OPTION_VERBOSITY) {
// 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) {
// Déjà géré via $this->copyVerbosityOptionOf // Déjà géré via $this->copyVerbosityOptionOf
continue; continue;
} }
if ((in_array($optionName, self::SYMFONY_OPTIONS_BOOL) && $optionValue !== false)
|| (in_array($optionName, self::SYMFONY_OPTIONS_TEXT) && $optionValue !== null)
) {
$this->addOption($optionName, $optionValue); $this->addOption($optionName, $optionValue);
} }
}
return $this; return $this;
} }
/** /**

Loading…
Cancel
Save