1
0
Fork 0

Config - always respect COMPOSER_DISCARD_CHANGES

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

View File

@ -389,7 +389,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, array('stash', 'true', 'false', '1', '0'), true)) {
throw new \RuntimeException(
"Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
@ -551,7 +552,7 @@ class Config
* that overload config values.
*
* @param string $var
* @return string|bool
* @return string|false
*/
private function getComposerEnv($var)
{