Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
[lhc/web/wiklou.git] / includes / interwiki / ClassicInterwikiLookup.php
index f19e3db..eada9d4 100644 (file)
@@ -1,6 +1,4 @@
 <?php
-namespace MediaWiki\Interwiki;
-
 /**
  * InterwikiLookup implementing the "classic" interwiki storage (hardcoded up to MW 1.26).
  *
@@ -21,14 +19,17 @@ namespace MediaWiki\Interwiki;
  *
  * @file
  */
-use \Cdb\Exception as CdbException;
-use \Cdb\Reader as CdbReader;
-use Database;
+
+namespace MediaWiki\Interwiki;
+
+use Cdb\Exception as CdbException;
+use Cdb\Reader as CdbReader;
 use Hooks;
 use Interwiki;
 use Language;
 use MapCacheLRU;
 use WANObjectCache;
+use Wikimedia\Rdbms\Database;
 
 /**
  * InterwikiLookup implementing the "classic" interwiki storage (hardcoded up to MW 1.26).
@@ -313,10 +314,10 @@ class ClassicInterwikiLookup implements InterwikiLookup {
        private function loadFromArray( $mc ) {
                if ( isset( $mc['iw_url'] ) ) {
                        $url = $mc['iw_url'];
-                       $local = isset( $mc['iw_local'] ) ? $mc['iw_local'] : 0;
-                       $trans = isset( $mc['iw_trans'] ) ? $mc['iw_trans'] : 0;
-                       $api = isset( $mc['iw_api'] ) ? $mc['iw_api'] : '';
-                       $wikiId = isset( $mc['iw_wikiid'] ) ? $mc['iw_wikiid'] : '';
+                       $local = $mc['iw_local'] ?? 0;
+                       $trans = $mc['iw_trans'] ?? 0;
+                       $api = $mc['iw_api'] ?? '';
+                       $wikiId = $mc['iw_wikiid'] ?? '';
 
                        return new Interwiki( null, $url, $api, $wikiId, $local, $trans );
                }
@@ -383,8 +384,6 @@ class ClassicInterwikiLookup implements InterwikiLookup {
                                . $e->getMessage() );
                }
 
-               ksort( $data );
-
                return array_values( $data );
        }