From 33415e2930b8e583fe81ec026608c0af523f7afe Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Thu, 10 Oct 2019 16:56:18 -0700 Subject: [PATCH] Follow-up Ifa346c8a92: LanguageNameUtils: CONSTRUCTOR_OTPIONS, not constructorOptions Change-Id: I357dddf39834e9eed4b173245033d2f27edab329 (cherry picked from commit b83a3e3e3afaba41545abf1211e85558e81a3f9a) --- includes/ServiceWiring.php | 2 +- includes/language/LanguageNameUtils.php | 4 ++-- tests/phpunit/includes/config/TestAllServiceOptionsUsed.php | 2 +- .../phpunit/unit/includes/language/LanguageNameUtilsTest.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/ServiceWiring.php b/includes/ServiceWiring.php index 6e31e864d9..7468bd7d88 100644 --- a/includes/ServiceWiring.php +++ b/includes/ServiceWiring.php @@ -262,7 +262,7 @@ return [ 'LanguageNameUtils' => function ( MediaWikiServices $services ) : LanguageNameUtils { return new LanguageNameUtils( new ServiceOptions( - LanguageNameUtils::$constructorOptions, + LanguageNameUtils::CONSTRUCTOR_OPTIONS, $services->getMainConfig() ) ); }, diff --git a/includes/language/LanguageNameUtils.php b/includes/language/LanguageNameUtils.php index 08d9ab3e0d..ea34b0c571 100644 --- a/includes/language/LanguageNameUtils.php +++ b/includes/language/LanguageNameUtils.php @@ -78,7 +78,7 @@ class LanguageNameUtils { */ private $validCodeCache = []; - public static $constructorOptions = [ + public const CONSTRUCTOR_OPTIONS = [ 'ExtraLanguageNames', 'UsePigLatinVariant', ]; @@ -87,7 +87,7 @@ class LanguageNameUtils { * @param ServiceOptions $options */ public function __construct( ServiceOptions $options ) { - $options->assertRequiredOptions( self::$constructorOptions ); + $options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS ); $this->options = $options; } diff --git a/tests/phpunit/includes/config/TestAllServiceOptionsUsed.php b/tests/phpunit/includes/config/TestAllServiceOptionsUsed.php index 618472b526..6f0ccd94d1 100644 --- a/tests/phpunit/includes/config/TestAllServiceOptionsUsed.php +++ b/tests/phpunit/includes/config/TestAllServiceOptionsUsed.php @@ -2,7 +2,7 @@ /** * Use this trait to check that code run by tests accesses every key declared for this class' - * ServiceOptions, e.g., in a $constructorOptions member variable. To use this trait, you need to do + * ServiceOptions, e.g., in a CONSTRUCTOR_OPTIONS member const. To use this trait, you need to do * two things (other than use-ing it): * * 1) Don't use the regular ServiceOptions when constructing your objects, but rather diff --git a/tests/phpunit/unit/includes/language/LanguageNameUtilsTest.php b/tests/phpunit/unit/includes/language/LanguageNameUtilsTest.php index 6fbd4a2863..bb7a1d29a1 100644 --- a/tests/phpunit/unit/includes/language/LanguageNameUtilsTest.php +++ b/tests/phpunit/unit/includes/language/LanguageNameUtilsTest.php @@ -9,7 +9,7 @@ class LanguageNameUtilsTest extends MediaWikiUnitTestCase { */ private static function newObj( array $optionsArray = [] ) : LanguageNameUtils { return new LanguageNameUtils( new ServiceOptions( - LanguageNameUtils::$constructorOptions, + LanguageNameUtils::CONSTRUCTOR_OPTIONS, $optionsArray, [ 'ExtraLanguageNames' => [], -- 2.20.1