Follow-up Ifa346c8a92: LanguageNameUtils: CONSTRUCTOR_OTPIONS, not constructorOptions
authorJames D. Forrester <jforrester@wikimedia.org>
Thu, 10 Oct 2019 23:56:18 +0000 (16:56 -0700)
committerJforrester <jforrester@wikimedia.org>
Fri, 11 Oct 2019 00:21:06 +0000 (00:21 +0000)
Change-Id: I357dddf39834e9eed4b173245033d2f27edab329
(cherry picked from commit b83a3e3e3afaba41545abf1211e85558e81a3f9a)

includes/ServiceWiring.php
includes/language/LanguageNameUtils.php
tests/phpunit/includes/config/TestAllServiceOptionsUsed.php
tests/phpunit/unit/includes/language/LanguageNameUtilsTest.php

index 6e31e86..7468bd7 100644 (file)
@@ -262,7 +262,7 @@ return [
 
        'LanguageNameUtils' => function ( MediaWikiServices $services ) : LanguageNameUtils {
                return new LanguageNameUtils( new ServiceOptions(
-                       LanguageNameUtils::$constructorOptions,
+                       LanguageNameUtils::CONSTRUCTOR_OPTIONS,
                        $services->getMainConfig()
                ) );
        },
index 08d9ab3..ea34b0c 100644 (file)
@@ -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;
        }
 
index 618472b..6f0ccd9 100644 (file)
@@ -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
index 6fbd4a2..bb7a1d2 100644 (file)
@@ -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' => [],