X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fconfig%2FConfigRepository.php;h=d48eb0ec431ab410882b4b3699a56091a33a8182;hb=dfec83932fd38a9086eb5a2e212889ad00f35b0e;hp=c87a3440b60470c02c05e6909ab6c9d736679ab8;hpb=97af92da48f0d434cf4b541e7a3f2d96619a95b2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/config/ConfigRepository.php b/includes/config/ConfigRepository.php index c87a3440b6..d48eb0ec43 100644 --- a/includes/config/ConfigRepository.php +++ b/includes/config/ConfigRepository.php @@ -22,8 +22,8 @@ namespace MediaWiki\Config; -use MediaWiki\Services\SalvageableService; use Wikimedia\Assert\Assert; +use Wikimedia\Services\SalvageableService; /** * Object which holds currently registered configuration options. @@ -71,10 +71,8 @@ class ConfigRepository implements SalvageableService { if ( !$this->has( $name, true ) ) { throw new \ConfigException( 'The configuration option ' . $name . ' does not exist.' ); } - if ( isset( $this->configItems['public'][$name] ) ) { - return $this->configItems['public'][$name]; - } - return $this->configItems['private'][$name]; + + return $this->configItems['public'][$name] ?? $this->configItems['private'][$name]; } /** @@ -191,19 +189,12 @@ class ConfigRepository implements SalvageableService { public function salvage( SalvageableService $other ) { Assert::parameterType( self::class, $other, '$other' ); - /** @var ConfigRepository $other */ - $otherCurrentObj = $other->current(); foreach ( $other->configItems['public'] as $name => $otherConfig ) { if ( isset( $this->configItems['public'][$name] ) ) { continue; } $this->add( $name, $otherConfig ); - - // recover the pointer of the other config repository - if ( $otherCurrentObj === $otherConfig ) { - end( $this->configItems['public'] ); - } } foreach ( $other->configItems['private'] as $name => $otherConfig ) { if ( isset( $this->configItems['private'][$name] ) ) { @@ -211,11 +202,6 @@ class ConfigRepository implements SalvageableService { } $this->add( $name, $otherConfig ); - - // recover the pointer of the other config repository - if ( $otherCurrentObj === $otherConfig ) { - end( $this->configItems['private'] ); - } } // disable $other