1
0
Fork 0

Config - always respect COMPOSER_DISCARD_CHANGES

pull/11037/head
Ondřej Mirtes 2022-08-26 15:01:28 +02:00 committed by Jordi Boggiano
parent a1bc424a06
commit 13421f7d66
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 3 additions and 2 deletions

View File

@ -376,7 +376,8 @@ class Config
return $value;
case 'discard-changes':
if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
$env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES');
if ($env !== false) {
if (!in_array($env, ['stash', 'true', 'false', '1', '0'], true)) {
throw new \RuntimeException(
"Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
@ -519,7 +520,7 @@ class Config
* This should be used to read COMPOSER_ environment variables
* that overload config values.
*
* @return string|bool
* @return string|false
*/
private function getComposerEnv(string $var)
{