| @@ -17,9 +17,9 @@ discard block | ||
| 17 | 17 | */ | 
| 18 | 18 |  	public function testGetSingletonOnInvalidEnvironment() { | 
| 19 | 19 | |
| 20 | - $this->expectException( \Exception::class ); | |
| 20 | + $this->expectException(\Exception::class); | |
| 21 | 21 | |
| 22 | - self::assertInstanceOf( ExtensionRegistryHelper::class, ExtensionRegistryHelper::singleton() ); | |
| 22 | + self::assertInstanceOf(ExtensionRegistryHelper::class, ExtensionRegistryHelper::singleton()); | |
| 23 | 23 | } | 
| 24 | 24 | |
| 25 | 25 | /** | 
| @@ -28,7 +28,7 @@ discard block | ||
| 28 | 28 |  	public function testGetSingleton() { | 
| 29 | 29 | |
| 30 | 30 | $GLOBALS[ 'wgVersion' ] = '1.27'; | 
| 31 | - self::assertInstanceOf( ExtensionRegistryHelper::class, ExtensionRegistryHelper::singleton() ); | |
| 31 | + self::assertInstanceOf(ExtensionRegistryHelper::class, ExtensionRegistryHelper::singleton()); | |
| 32 | 32 | } | 
| 33 | 33 | |
| 34 | 34 | |
| @@ -24,8 +24,8 @@ discard block | ||
| 24 | 24 | * @throws \Exception | 
| 25 | 25 | */ | 
| 26 | 26 |  	public function __construct() { | 
| 27 | -		if ( ! isset( $GLOBALS[ 'wgVersion' ] ) || version_compare( $GLOBALS[ 'wgVersion' ], '1.27', '<' ) ) { | |
| 28 | - throw new \Exception( 'ExtensionRegistryHelper requires MediaWiki 1.27 or above.' ); | |
| 27 | +		if (!isset($GLOBALS[ 'wgVersion' ]) || version_compare($GLOBALS[ 'wgVersion' ], '1.27', '<')) { | |
| 28 | +			throw new \Exception('ExtensionRegistryHelper requires MediaWiki 1.27 or above.'); | |
| 29 | 29 | } | 
| 30 | 30 | } | 
| 31 | 31 | |
| @@ -35,7 +35,7 @@ discard block | ||
| 35 | 35 | * @throws \Exception | 
| 36 | 36 | */ | 
| 37 | 37 |  	public static function singleton() { | 
| 38 | -		if ( !self::$singleton ) { | |
| 38 | +		if (!self::$singleton) { | |
| 39 | 39 | self::$singleton = new self(); | 
| 40 | 40 | } | 
| 41 | 41 | |
| @@ -48,9 +48,9 @@ discard block | ||
| 48 | 48 | * | 
| 49 | 49 | * @throws \Exception | 
| 50 | 50 | */ | 
| 51 | -	public function loadExtensionRecursive( $extensionName, $path = null ) { | |
| 51 | +	public function loadExtensionRecursive($extensionName, $path = null) { | |
| 52 | 52 | $path = $path ?: $GLOBALS[ 'wgExtensionDirectory' ] . '/' . $extensionName . '/extension.json'; | 
| 53 | - $this->loadModuleRecursive( $extensionName, $path ); | |
| 53 | + $this->loadModuleRecursive($extensionName, $path); | |
| 54 | 54 | } | 
| 55 | 55 | |
| 56 | 56 | /** | 
| @@ -59,9 +59,9 @@ discard block | ||
| 59 | 59 | * | 
| 60 | 60 | * @throws \Exception | 
| 61 | 61 | */ | 
| 62 | -	public function loadSkinRecursive( $skinName, $path = null ) { | |
| 62 | +	public function loadSkinRecursive($skinName, $path = null) { | |
| 63 | 63 | $path = $path ?: $GLOBALS[ 'wgStyleDirectory' ] . '/' . $skinName . '/skin.json'; | 
| 64 | - $this->loadModuleRecursive( $skinName, $path ); | |
| 64 | + $this->loadModuleRecursive($skinName, $path); | |
| 65 | 65 | } | 
| 66 | 66 | |
| 67 | 67 | /** | 
| @@ -69,27 +69,27 @@ discard block | ||
| 69 | 69 | * | 
| 70 | 70 | * @throws \Exception | 
| 71 | 71 | */ | 
| 72 | -	protected function loadModuleRecursive( $moduleName, $path ) { | |
| 72 | +	protected function loadModuleRecursive($moduleName, $path) { | |
| 73 | 73 | |
| 74 | 74 | $extensionRegistry = \ExtensionRegistry::getInstance(); | 
| 75 | 75 | |
| 76 | -		if ( !$extensionRegistry->isLoaded( $moduleName ) && !array_key_exists( $path, $extensionRegistry->getQueue() ) ) { | |
| 76 | +		if (!$extensionRegistry->isLoaded($moduleName) && !array_key_exists($path, $extensionRegistry->getQueue())) { | |
| 77 | 77 | |
| 78 | 78 | $subregistry = new \ExtensionRegistry(); | 
| 79 | 79 | |
| 80 | -			if ( version_compare( MW_VERSION, '1.34', '<' ) ) { | |
| 81 | - $subregistry->load( $path ); | |
| 80 | +			if (version_compare(MW_VERSION, '1.34', '<')) { | |
| 81 | + $subregistry->load($path); | |
| 82 | 82 |  			} else { | 
| 83 | - $subregistry->queue( $path ); | |
| 83 | + $subregistry->queue($path); | |
| 84 | 84 | $subregistry->loadFromQueue(); | 
| 85 | 85 | } | 
| 86 | 86 | |
| 87 | 87 |  			try { | 
| 88 | - $loadedRefl = new \ReflectionProperty( \ExtensionRegistry::class, 'loaded' ); | |
| 89 | - $loadedRefl->setAccessible( true ); | |
| 90 | - $loadedRefl->setValue( $extensionRegistry, $extensionRegistry->getAllThings() + $subregistry->getAllThings() ); | |
| 91 | -			} catch ( \Exception $e ) { | |
| 92 | - throw new \Exception( 'This version of MediaWiki does not support ExtensionRegistryHelper.', 0, $e ); | |
| 88 | + $loadedRefl = new \ReflectionProperty(\ExtensionRegistry::class, 'loaded'); | |
| 89 | + $loadedRefl->setAccessible(true); | |
| 90 | + $loadedRefl->setValue($extensionRegistry, $extensionRegistry->getAllThings() + $subregistry->getAllThings()); | |
| 91 | +			} catch (\Exception $e) { | |
| 92 | +				throw new \Exception('This version of MediaWiki does not support ExtensionRegistryHelper.', 0, $e); | |
| 93 | 93 | } | 
| 94 | 94 | |
| 95 | 95 | } |