diff --git a/src/Composer/Config/JsonConfigSource.php b/src/Composer/Config/JsonConfigSource.php index 1eeaee6f4..6a4682539 100644 --- a/src/Composer/Config/JsonConfigSource.php +++ b/src/Composer/Config/JsonConfigSource.php @@ -79,11 +79,11 @@ class JsonConfigSource implements ConfigSourceInterface */ public function addConfigSetting($name, $value) { - $that = $this; - $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($that) { + $authConfig = $this->authConfig; + $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) { if (preg_match('{^(github-oauth|gitlab-oauth|http-basic|platform)\.}', $key)) { list($key, $host) = explode('.', $key, 2); - if ($that->authConfig) { + if ($authConfig) { $config[$key][$host] = $val; } else { $config['config'][$key][$host] = $val; @@ -99,11 +99,11 @@ class JsonConfigSource implements ConfigSourceInterface */ public function removeConfigSetting($name) { - $that = $this; - $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($that) { + $authConfig = $this->authConfig; + $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) { if (preg_match('{^(github-oauth|gitlab-oauth|http-basic|platform)\.}', $key)) { list($key, $host) = explode('.', $key, 2); - if ($that->authConfig) { + if ($authConfig) { unset($config[$key][$host]); } else { unset($config['config'][$key][$host]);