jenkins-bot has submitted this change and it was merged.

Change subject: Use array_merge, not array() + array()
......................................................................


Use array_merge, not array() + array()

Change-Id: I72247e7d568815d2ce707464f26d26143d49ae23
---
M includes/JCApi.php
M includes/JCSingleton.php
2 files changed, 28 insertions(+), 8 deletions(-)

Approvals:
  Reedy: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/JCApi.php b/includes/JCApi.php
index 8967be6..2a6f58d 100644
--- a/includes/JCApi.php
+++ b/includes/JCApi.php
@@ -54,8 +54,10 @@
                                $result->addValue(
                                        null,
                                        'models',
-                                       
\ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigModels' )
-                                       + $wgJsonConfigModels
+                                       array_merge(
+                                               
\ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigModels' ),
+                                               $wgJsonConfigModels
+                                       )
                                );
 
                                $data = array();
diff --git a/includes/JCSingleton.php b/includes/JCSingleton.php
index 15d98c8..62130f7 100644
--- a/includes/JCSingleton.php
+++ b/includes/JCSingleton.php
@@ -69,8 +69,14 @@
                list( self::$titleMap, self::$namespaces ) = 
self::parseConfiguration(
                        $wgNamespaceContentModels,
                        $wgContentHandlers,
-                       \ExtensionRegistry::getInstance()->getAttribute( 
'JsonConfigs' ) + $wgJsonConfigs,
-                       \ExtensionRegistry::getInstance()->getAttribute( 
'JsonConfigModels' ) + $wgJsonConfigModels
+                       array_merge(
+                               
\ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigs' ),
+                               $wgJsonConfigs
+                       ),
+                       array_merge(
+                               
\ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigModels' ),
+                               $wgJsonConfigModels
+                       )
                );
        }
 
@@ -384,13 +390,19 @@
 
        public static function getContentClass( $modelId ) {
                global $wgJsonConfigModels;
-               $configModels = 
\ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigModels' ) + 
$wgJsonConfigModels;
+               $configModels = array_merge(
+                       \ExtensionRegistry::getInstance()->getAttribute( 
'JsonConfigModels' ),
+                       $wgJsonConfigModels
+               );
                $class = null;
                if ( array_key_exists( $modelId, $configModels ) ) {
                        $value = $configModels[$modelId];
                        if ( is_array( $value ) ) {
                                if ( !array_key_exists( 'class', $value ) ) {
-                                       wfLogWarning( "JsonConfig: Invalid 
\$wgJsonConfigModels['$modelId'] array value, 'class' not found" );
+                                       wfLogWarning(
+                                               "JsonConfig: Invalid 
\$wgJsonConfigModels['$modelId'] array value,
+                                               'class' not found"
+                                       );
                                } else {
                                        $class = $value['class'];
                                }
@@ -579,7 +591,10 @@
                }
 
                self::init();
-               $models = \ExtensionRegistry::getInstance()->getAttribute( 
'JsonConfigModels' ) + $wgJsonConfigModels;
+               $models = array_merge(
+                       \ExtensionRegistry::getInstance()->getAttribute( 
'JsonConfigModels' ),
+                       $wgJsonConfigModels
+               );
                if ( array_key_exists( $modelId, $models ) ) {
                        // This is one of our model IDs
                        $handler = new JCContentHandler( $modelId );
@@ -784,7 +799,10 @@
                if ( $isStorage === null ) {
                        global $wgJsonConfigs;
                        $isStorage = false;
-                       $configs = 
\ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigs' ) + 
$wgJsonConfigs;
+                       $configs = array_merge(
+                               
\ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigs' ),
+                               $wgJsonConfigs
+                       );
                        foreach ( $configs as $jc ) {
                                if ( ( !array_key_exists( 'isLocal', $jc ) || 
$jc['isLocal'] ) ||
                                         ( array_key_exists( 'store', $jc ) )

-- 
To view, visit https://gerrit.wikimedia.org/r/315845
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I72247e7d568815d2ce707464f26d26143d49ae23
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/JsonConfig
Gerrit-Branch: wmf/1.28.0-wmf.22
Gerrit-Owner: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to