* Allow config unset for unrecognized keys * Move config key removal after all other checks Because key removal is done without matching the key in the recognized composer.json schema, leaving the key removal before other check would have stopped the execution there without reaching the specific config add (eg. composer config repo [--unset]) Co-authored-by: Liviu Iosif <liviu.iosif@code932.com>pull/10635/head
parent
e918b6001b
commit
b8b84c2c35
|
@ -634,11 +634,6 @@ EOT
|
||||||
if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || strpos($settingKey, 'extra.') === 0)) {
|
if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || strpos($settingKey, 'extra.') === 0)) {
|
||||||
throw new \InvalidArgumentException('The ' . $settingKey . ' property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json');
|
throw new \InvalidArgumentException('The ' . $settingKey . ' property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json');
|
||||||
}
|
}
|
||||||
if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
|
|
||||||
$this->configSource->removeProperty($settingKey);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (isset($uniqueProps[$settingKey])) {
|
if (isset($uniqueProps[$settingKey])) {
|
||||||
$this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
|
$this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
|
||||||
|
|
||||||
|
@ -801,6 +796,12 @@ EOT
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($input->getOption('unset')) {
|
||||||
|
$this->configSource->removeProperty($settingKey);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
|
throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue