Services: Convert LocalisationCache's static to a const now HHVM is gone
authorJames D. Forrester <jforrester@wikimedia.org>
Tue, 8 Oct 2019 18:25:30 +0000 (11:25 -0700)
committerJames D. Forrester <jforrester@wikimedia.org>
Tue, 8 Oct 2019 20:31:48 +0000 (13:31 -0700)
Change-Id: If5c015debed7efc034613b976bc5292ac30036d7
(cherry picked from commit ebac0247cf38b45a253042be16998c7fffbffcbc)

includes/ServiceWiring.php
includes/cache/localisation/LocalisationCache.php
maintenance/rebuildLocalisationCache.php
tests/phpunit/includes/cache/LocalisationCacheTest.php

index 003b640..4f3f5d9 100644 (file)
@@ -298,7 +298,7 @@ return [
 
                return new $conf['class'](
                        new ServiceOptions(
 
                return new $conf['class'](
                        new ServiceOptions(
-                               LocalisationCache::$constructorOptions,
+                               LocalisationCache::CONSTRUCTOR_OPTIONS,
                                // Two of the options are stored in $wgLocalisationCacheConf
                                $conf,
                                // In case someone set that config variable and didn't reset all keys, set defaults.
                                // Two of the options are stored in $wgLocalisationCacheConf
                                $conf,
                                // In case someone set that config variable and didn't reset all keys, set defaults.
index 0f186b6..a9e6969 100644 (file)
@@ -221,12 +221,10 @@ class LocalisationCache {
        }
 
        /**
        }
 
        /**
-        * @todo Make this a const when HHVM support is dropped (T192166)
-        *
         * @var array
         * @since 1.34
         */
         * @var array
         * @since 1.34
         */
-       public static $constructorOptions = [
+       public const CONSTRUCTOR_OPTIONS = [
                // True to treat all files as expired until they are regenerated by this object.
                'forceRecache',
                'manualRecache',
                // True to treat all files as expired until they are regenerated by this object.
                'forceRecache',
                'manualRecache',
@@ -254,7 +252,7 @@ class LocalisationCache {
                LoggerInterface $logger,
                array $clearStoreCallbacks = []
        ) {
                LoggerInterface $logger,
                array $clearStoreCallbacks = []
        ) {
-               $options->assertRequiredOptions( self::$constructorOptions );
+               $options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS );
 
                $this->options = $options;
                $this->store = $store;
 
                $this->options = $options;
                $this->store = $store;
index 1f4ac85..07c5569 100644 (file)
@@ -88,7 +88,7 @@ class RebuildLocalisationCache extends Maintenance {
                // XXX Copy-pasted from ServiceWiring.php. Do we need a factory for this one caller?
                $lc = new LocalisationCacheBulkLoad(
                        new ServiceOptions(
                // XXX Copy-pasted from ServiceWiring.php. Do we need a factory for this one caller?
                $lc = new LocalisationCacheBulkLoad(
                        new ServiceOptions(
-                               LocalisationCache::$constructorOptions,
+                               LocalisationCache::CONSTRUCTOR_OPTIONS,
                                $conf,
                                MediaWikiServices::getInstance()->getMainConfig()
                        ),
                                $conf,
                                MediaWikiServices::getInstance()->getMainConfig()
                        ),
index ecdfae4..af1ff86 100644 (file)
@@ -26,7 +26,7 @@ class LocalisationCacheTest extends MediaWikiTestCase {
 
                $lc = $this->getMockBuilder( LocalisationCache::class )
                        ->setConstructorArgs( [
 
                $lc = $this->getMockBuilder( LocalisationCache::class )
                        ->setConstructorArgs( [
-                               new ServiceOptions( LocalisationCache::$constructorOptions, [
+                               new ServiceOptions( LocalisationCache::CONSTRUCTOR_OPTIONS, [
                                        'forceRecache' => false,
                                        'manualRecache' => false,
                                        'ExtensionMessagesFiles' => [],
                                        'forceRecache' => false,
                                        'manualRecache' => false,
                                        'ExtensionMessagesFiles' => [],