From: James D. Forrester Date: Tue, 8 Oct 2019 18:25:30 +0000 (-0700) Subject: Services: Convert LocalisationCache's static to a const now HHVM is gone X-Git-Tag: 1.34.0-rc.0~20^2 X-Git-Url: http://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=101493a70783b15656daa0686d404ac1a7a6976b Services: Convert LocalisationCache's static to a const now HHVM is gone Change-Id: If5c015debed7efc034613b976bc5292ac30036d7 (cherry picked from commit ebac0247cf38b45a253042be16998c7fffbffcbc) --- diff --git a/includes/ServiceWiring.php b/includes/ServiceWiring.php index 003b640ad8..4f3f5d9241 100644 --- a/includes/ServiceWiring.php +++ b/includes/ServiceWiring.php @@ -298,7 +298,7 @@ return [ 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. diff --git a/includes/cache/localisation/LocalisationCache.php b/includes/cache/localisation/LocalisationCache.php index 0f186b67c6..a9e69697d6 100644 --- a/includes/cache/localisation/LocalisationCache.php +++ b/includes/cache/localisation/LocalisationCache.php @@ -221,12 +221,10 @@ class LocalisationCache { } /** - * @todo Make this a const when HHVM support is dropped (T192166) - * * @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', @@ -254,7 +252,7 @@ class LocalisationCache { LoggerInterface $logger, array $clearStoreCallbacks = [] ) { - $options->assertRequiredOptions( self::$constructorOptions ); + $options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS ); $this->options = $options; $this->store = $store; diff --git a/maintenance/rebuildLocalisationCache.php b/maintenance/rebuildLocalisationCache.php index 1f4ac8517a..07c55698df 100644 --- a/maintenance/rebuildLocalisationCache.php +++ b/maintenance/rebuildLocalisationCache.php @@ -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( - LocalisationCache::$constructorOptions, + LocalisationCache::CONSTRUCTOR_OPTIONS, $conf, MediaWikiServices::getInstance()->getMainConfig() ), diff --git a/tests/phpunit/includes/cache/LocalisationCacheTest.php b/tests/phpunit/includes/cache/LocalisationCacheTest.php index ecdfae4614..af1ff86515 100644 --- a/tests/phpunit/includes/cache/LocalisationCacheTest.php +++ b/tests/phpunit/includes/cache/LocalisationCacheTest.php @@ -26,7 +26,7 @@ class LocalisationCacheTest extends MediaWikiTestCase { $lc = $this->getMockBuilder( LocalisationCache::class ) ->setConstructorArgs( [ - new ServiceOptions( LocalisationCache::$constructorOptions, [ + new ServiceOptions( LocalisationCache::CONSTRUCTOR_OPTIONS, [ 'forceRecache' => false, 'manualRecache' => false, 'ExtensionMessagesFiles' => [],