From 101493a70783b15656daa0686d404ac1a7a6976b Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Tue, 8 Oct 2019 11:25:30 -0700 Subject: [PATCH] Services: Convert LocalisationCache's static to a const now HHVM is gone Change-Id: If5c015debed7efc034613b976bc5292ac30036d7 (cherry picked from commit ebac0247cf38b45a253042be16998c7fffbffcbc) --- includes/ServiceWiring.php | 2 +- includes/cache/localisation/LocalisationCache.php | 6 ++---- maintenance/rebuildLocalisationCache.php | 2 +- tests/phpunit/includes/cache/LocalisationCacheTest.php | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) 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' => [], -- 2.20.1