Sort MediaWikiServices and ServiceWiring alphabetically
authorTim Starling <tstarling@wikimedia.org>
Wed, 10 Apr 2019 10:36:02 +0000 (20:36 +1000)
committerTim Starling <tstarling@wikimedia.org>
Wed, 10 Apr 2019 10:59:49 +0000 (20:59 +1000)
Don't sort them asciibetically, which is a weird sort order people only
use by accident.

Change-Id: I69be64dab104130841855f2ce58bf94667c0c300

includes/MediaWikiServices.php
includes/ServiceWiring.php
tests/phpunit/includes/MediaWikiServicesTest.php
tests/phpunit/includes/ServiceWiringTest.php

index 473cbe5..8c60dc7 100644 (file)
@@ -668,14 +668,6 @@ class MediaWikiServices extends ServiceContainer {
                return $this->getService( 'MimeAnalyzer' );
        }
 
-       /**
-        * @since 1.32
-        * @return NameTableStoreFactory
-        */
-       public function getNameTableStoreFactory() {
-               return $this->getService( 'NameTableStoreFactory' );
-       }
-
        /**
         * @since 1.33
         * @return NamespaceInfo
@@ -684,6 +676,14 @@ class MediaWikiServices extends ServiceContainer {
                return $this->getService( 'NamespaceInfo' );
        }
 
+       /**
+        * @since 1.32
+        * @return NameTableStoreFactory
+        */
+       public function getNameTableStoreFactory() {
+               return $this->getService( 'NameTableStoreFactory' );
+       }
+
        /**
         * @since 1.32
         * @return OldRevisionImporter
index 750c964..722bac1 100644 (file)
@@ -330,6 +330,10 @@ return [
                return new MimeAnalyzer( $params );
        },
 
+       'NamespaceInfo' => function ( MediaWikiServices $services ) : NamespaceInfo {
+               return new NamespaceInfo( $services->getMainConfig() );
+       },
+
        'NameTableStoreFactory' => function ( MediaWikiServices $services ) : NameTableStoreFactory {
                return new NameTableStoreFactory(
                        $services->getDBLoadBalancerFactory(),
@@ -338,10 +342,6 @@ return [
                );
        },
 
-       'NamespaceInfo' => function ( MediaWikiServices $services ) : NamespaceInfo {
-               return new NamespaceInfo( $services->getMainConfig() );
-       },
-
        'OldRevisionImporter' => function ( MediaWikiServices $services ) : OldRevisionImporter {
                return new ImportableOldRevisionImporter(
                        true,
index 1cd40ed..9d6164c 100644 (file)
@@ -364,7 +364,7 @@ class MediaWikiServicesTest extends MediaWikiTestCase {
                } ) );
 
                $sortedNames = $names;
-               sort( $sortedNames );
+               natcasesort( $sortedNames );
 
                $this->assertSame( $sortedNames, $names,
                        'Please keep service getters sorted alphabetically' );
index 74e8e1b..02e06f8 100644 (file)
@@ -8,7 +8,7 @@ class ServiceWiringTest extends MediaWikiTestCase {
                global $IP;
                $services = array_keys( require "$IP/includes/ServiceWiring.php" );
                $sortedServices = $services;
-               sort( $sortedServices );
+               natcasesort( $sortedServices );
 
                $this->assertSame( $sortedServices, $services,
                        'Please keep services sorted alphabetically' );