MaxSem has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316023

Change subject: Convert arrays to new syntax
......................................................................

Convert arrays to new syntax

Change-Id: Id24e9e4c2a8720af76adcfb9fdf07b74e80f68a3
---
M includes/ApiGraph.php
M includes/DataModule.php
M includes/Graph.hooks.php
M includes/ParserTag.php
M includes/Sandbox.php
5 files changed, 34 insertions(+), 34 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Graph 
refs/changes/23/316023/1

diff --git a/includes/ApiGraph.php b/includes/ApiGraph.php
index 1c08046..6ae4f5f 100644
--- a/includes/ApiGraph.php
+++ b/includes/ApiGraph.php
@@ -47,24 +47,24 @@
        }
 
        public function getAllowedParams() {
-               return array(
-                       'hash' => array(
+               return [
+                       'hash' => [
                                ApiBase::PARAM_TYPE => 'string',
-                       ),
-                       'title' => array(
+                       ],
+                       'title' => [
                                ApiBase::PARAM_TYPE => 'string',
-                       ),
-                       'text' => array(
+                       ],
+                       'text' => [
                                ApiBase::PARAM_TYPE => 'string',
-                       ),
-               );
+                       ],
+               ];
        }
 
        protected function getExamplesMessages() {
-               return array(
+               return [
                        
'formatversion=2&action=graph&title=Extension%3AGraph%2FDemo&hash=1533aaad45c733dcc7e07614b54cbae4119a6747'
                                => 'apihelp-graph-example',
-               );
+               ];
        }
 
        /**
@@ -108,10 +108,10 @@
                                $this->dieUsage( 'Invalid title given.', 
'invalidtitle' );
                        }
 
-                       $ppValue = $this->getDB()->selectField( 'page_props', 
'pp_value', array(
+                       $ppValue = $this->getDB()->selectField( 'page_props', 
'pp_value', [
                                'pp_page' => $title->getArticleID(),
                                'pp_propname' => 'graph_specs',
-                       ), __METHOD__ );
+                       ], __METHOD__ );
 
                        if ( $ppValue ) {
                                // Copied from 
TemplateDataBlob.php:newFromDatabase()
diff --git a/includes/DataModule.php b/includes/DataModule.php
index 7b598f6..469b39b 100644
--- a/includes/DataModule.php
+++ b/includes/DataModule.php
@@ -14,14 +14,14 @@
 
 class DataModule extends ResourceLoaderModule {
 
-       protected $targets = array( 'desktop', 'mobile' );
+       protected $targets = [ 'desktop', 'mobile' ];
 
        public function getScript( ResourceLoaderContext $context ) {
                $config = $context->getResourceLoader()->getConfig();
-               return ResourceLoader::makeConfigSetScript( array(
+               return ResourceLoader::makeConfigSetScript( [
                        'wgGraphAllowedDomains' => $config->get( 
'GraphAllowedDomains' ),
                        'wgGraphIsTrusted' => $config->get( 'GraphIsTrusted' ),
-               ) );
+               ] );
        }
 
        public function enableModuleContentVersion() {
diff --git a/includes/Graph.hooks.php b/includes/Graph.hooks.php
index 18c2b49..b77cdc1 100644
--- a/includes/Graph.hooks.php
+++ b/includes/Graph.hooks.php
@@ -28,18 +28,18 @@
                        isset( $resourceModules[ 'ext.visualEditor.mediawiki' ] 
) ||
                        $resourceLoader->isModuleRegistered( 
'ext.visualEditor.mediawiki' )
                ) {
-                       $testModules['qunit']['ext.graph.visualEditor.test'] = 
array(
-                               'scripts' => array(
+                       $testModules['qunit']['ext.graph.visualEditor.test'] = [
+                               'scripts' => [
                                        
'modules/ve-graph/tests/ext.graph.visualEditor.test.js'
-                               ),
-                               'dependencies' => array(
+                               ],
+                               'dependencies' => [
                                        'ext.graph.visualEditor',
                                        'ext.graph.vega1',
                                        'ext.visualEditor.test'
-                               ),
+                               ],
                                'localBasePath' => dirname( __DIR__ ),
                                'remoteExtPath' => 'Graph'
-                       );
+                       ];
                }
 
                return true;
diff --git a/includes/ParserTag.php b/includes/ParserTag.php
index 8e8a608..a4fe751 100644
--- a/includes/ParserTag.php
+++ b/includes/ParserTag.php
@@ -102,7 +102,7 @@
         * @return array
         */
        private function buildDivAttributes( $mode = '', $data = false, $hash = 
'' ) {
-               $attribs = array( 'class' => 'mw-graph' );
+               $attribs = [ 'class' => 'mw-graph' ];
 
                if ( is_object( $data ) ) {
                        $width = property_exists( $data, 'width' ) && is_int( 
$data->width ) ? $data->width : 0;
@@ -169,7 +169,7 @@
                }
 
                // Calculate hash and store graph definition in graph_specs 
extension data
-               $specs = $this->parserOutput->getExtensionData( 'graph_specs' ) 
?: array();
+               $specs = $this->parserOutput->getExtensionData( 'graph_specs' ) 
?: [];
                // Make sure that multiple json blobs that only differ in 
spacing hash the same
                $hash = sha1( FormatJson::encode( $data, false, 
FormatJson::ALL_OK ) );
                $specs[$hash] = $data;
@@ -179,7 +179,7 @@
                if ( $this->parserOptions->getIsPreview() || 
!$wgGraphImgServiceUrl ) {
                        // Always do client-side rendering
                        $attribs = self::buildDivAttributes( 'always', $data, 
$hash );
-                       $liveSpecs = $this->parserOutput->getExtensionData( 
'graph_live_specs' ) ?: array();
+                       $liveSpecs = $this->parserOutput->getExtensionData( 
'graph_live_specs' ) ?: [];
                        $liveSpecs[$hash] = $data;
                        $this->parserOutput->setExtensionData( 
'graph_live_specs', $liveSpecs );
                        $html = ''; // will be injected with a <canvas> tag
@@ -190,10 +190,10 @@
                        $title = !$title ? '' : rawurlencode( 
$title->getPrefixedDBkey() );
                        $revid = rawurlencode( (string)$revid ) ?: '0';
                        $url = sprintf( $wgGraphImgServiceUrl, $server, $title, 
$revid, $hash );
-                       $imgAttrs = array(
+                       $imgAttrs = [
                                'class' => 'mw-graph-img',
                                'src' => $url,
-                       );
+                       ];
                        if ( $graphTitle ) {
                                // only add alt tag if we have some descriptive 
text
                                $imgAttrs['alt'] = $graphTitle;
@@ -207,19 +207,19 @@
 
                                // add the overlay title
                                if ( $graphTitle ) {
-                                       $hoverTitle = Html::element( 'div', 
array( 'class' => 'mw-graph-hover-title' ),
+                                       $hoverTitle = Html::element( 'div', [ 
'class' => 'mw-graph-hover-title' ],
                                                $graphTitle );
                                } else {
                                        $hoverTitle = '';
                                }
 
                                // Add a "make interactive" button
-                               $button = Html::rawElement( 'div', array( 
'class' => 'mw-graph-switch' ),
-                                       Html::rawElement( 'i', array( 'class' 
=> 'icon-play' ), '&#9658;' ) );
+                               $button = Html::rawElement( 'div', [ 'class' => 
'mw-graph-switch' ],
+                                       Html::rawElement( 'i', [ 'class' => 
'icon-play' ], '&#9658;' ) );
 
-                               $html .= Html::rawElement( 'div', array(
+                               $html .= Html::rawElement( 'div', [
                                        'class' => 'mw-graph-layover',
-                               ), $hoverTitle . $button );
+                               ], $hoverTitle . $button );
                        } else {
                                $attribs = self::buildDivAttributes( '', $data 
);
                        }
diff --git a/includes/Sandbox.php b/includes/Sandbox.php
index 072413a..665dfba 100644
--- a/includes/Sandbox.php
+++ b/includes/Sandbox.php
@@ -40,8 +40,8 @@
                $specHtml = '<div><textarea tabindex="1" accesskey="," 
id="wpTextbox1" cols="80" rows="40" style="" lang="en" dir="ltr" 
name="wpTextbox1" class="webfonts-changed"></textarea></div>';
                $jsonHtml = '<div><pre id="mw-graph-json"></pre></div>';
 
-               $out->addHTML( Html::rawElement( 'div', array( 'id' => 
'mw-graph-sandbox' ),
-                       Html::rawElement( 'div', array( 'id' => 'mw-graph-left' 
), $graphHtml . $jsonHtml ) .
-                       Html::rawElement( 'div', array( 'id' => 
'mw-graph-right' ), $specHtml ) ) );
+               $out->addHTML( Html::rawElement( 'div', [ 'id' => 
'mw-graph-sandbox' ],
+                       Html::rawElement( 'div', [ 'id' => 'mw-graph-left' ], 
$graphHtml . $jsonHtml ) .
+                       Html::rawElement( 'div', [ 'id' => 'mw-graph-right' ], 
$specHtml ) ) );
        }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id24e9e4c2a8720af76adcfb9fdf07b74e80f68a3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Graph
Gerrit-Branch: master
Gerrit-Owner: MaxSem <maxsem.w...@gmail.com>

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

Reply via email to