diff --git a/includes/ServiceWiring.php b/includes/ServiceWiring.php index f0883976ba4..c00ef3ebf26 100644 --- a/includes/ServiceWiring.php +++ b/includes/ServiceWiring.php @@ -275,7 +275,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 08d9ab3e0d8..ea34b0c5711 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 618472b526d..6f0ccd94d15 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 6fbd4a28636..bb7a1d29a1d 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' => [],