jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/366769 )

Change subject: Various array() to []
......................................................................


Various array() to []

Change-Id: I7657cc9a9fc061858feaa2911e72cda5e8086e6c
---
M rpc/RunJobs.php
M search-redirect.php
M tests/SiteConfiguration.php
M tests/TestServices.php
M tests/WgConfTestCase.php
M w/extract2.php
M w/health-check.php
M wmf-config/CirrusSearch-labs.php
M wmf-config/InitialiseSettings.php
9 files changed, 58 insertions(+), 57 deletions(-)

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



diff --git a/rpc/RunJobs.php b/rpc/RunJobs.php
index 2db74e7..6e90f33 100755
--- a/rpc/RunJobs.php
+++ b/rpc/RunJobs.php
@@ -18,7 +18,7 @@
  * @file
  * @author Aaron Schulz
  */
-if ( !in_array( $_SERVER['REMOTE_ADDR'], array( '127.0.0.1', 
'0:0:0:0:0:0:0:1', '::1' ), true ) ) {
+if ( !in_array( $_SERVER['REMOTE_ADDR'], [ '127.0.0.1', '0:0:0:0:0:0:0:1', 
'::1' ], true ) ) {
        die( "Only loopback requests are allowed.\n" );
 } elseif ( $_SERVER['REQUEST_METHOD'] !== 'POST' ) {
        die( "Request must use POST.\n" );
@@ -40,11 +40,11 @@
 try {
        $mediawiki = new MediaWiki();
        $runner = new JobRunner();
-       $response = $runner->run( array(
+       $response = $runner->run( [
                'type'     => isset( $_GET['type'] ) ? $_GET['type'] : false,
                'maxJobs'  => isset( $_GET['maxjobs'] ) ? $_GET['maxjobs'] : 
5000,
                'maxTime'  => isset( $_GET['maxtime'] ) ? $_GET['maxtime'] : 30
-       ) );
+       ] );
 
        print json_encode( $response, JSON_PRETTY_PRINT | 
JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
 
diff --git a/search-redirect.php b/search-redirect.php
index 12afdd3..63e5232 100644
--- a/search-redirect.php
+++ b/search-redirect.php
@@ -20,7 +20,7 @@
 }
 
 // validate $family
-$sites = array(
+$sites = [
        'wikipedia',
        'wiktionary',
        'wikisource',
@@ -30,7 +30,8 @@
        'wikiquote',
        'wikibooks',
        'wikivoyage',
-);
+];
+
 if ( !in_array( $family, $sites ) ) {
        $family = 'wikipedia';
 }
diff --git a/tests/SiteConfiguration.php b/tests/SiteConfiguration.php
index 5104d76..9acc4f39 100644
--- a/tests/SiteConfiguration.php
+++ b/tests/SiteConfiguration.php
@@ -122,24 +122,24 @@
        /**
         * Array of suffixes, for self::siteFromDB()
         */
-       public $suffixes = array();
+       public $suffixes = [];
 
        /**
         * Array of wikis, should be the same as $wgLocalDatabases
         */
-       public $wikis = array();
+       public $wikis = [];
 
        /**
         * The whole array of settings
         */
-       public $settings = array();
+       public $settings = [];
 
        /**
         * Array of domains that are local and can be handled by the same server
         *
         * @deprecated since 1.25; use $wgLocalVirtualHosts instead.
         */
-       public $localVHosts = array();
+       public $localVHosts = [];
 
        /**
         * Optional callback to load full configuration data.
@@ -170,7 +170,7 @@
         * Configuration cache for getConfig()
         * @var array
         */
-       protected $cfgCache = array();
+       protected $cfgCache = [];
 
        /**
         * Retrieves a configuration setting for a given wiki.
@@ -181,8 +181,8 @@
         * @param array $wikiTags The tags assigned to the wiki.
         * @return mixed The value of the setting requested.
         */
-       public function get( $settingName, $wiki, $suffix = null, $params = 
array(),
-               $wikiTags = array()
+       public function get( $settingName, $wiki, $suffix = null, $params = [],
+               $wikiTags = []
        ) {
                $params = $this->mergeParams( $wiki, $suffix, $params, 
$wikiTags );
                return $this->getSetting( $settingName, $wiki, $params );
@@ -220,7 +220,7 @@
                                                break 2;
                                        } elseif ( array_key_exists( "+$tag", 
$thisSetting ) && is_array( $thisSetting["+$tag"] ) ) {
                                                if ( $retval === null ) {
-                                                       $retval = array();
+                                                       $retval = [];
                                                }
                                                $retval = self::arrayMerge( 
$retval, $thisSetting["+$tag"] );
                                        }
@@ -239,7 +239,7 @@
                                                && is_array( 
$thisSetting["+$suffix"] )
                                        ) {
                                                if ( $retval === null ) {
-                                                       $retval = array();
+                                                       $retval = [];
                                                }
                                                $retval = self::arrayMerge( 
$retval, $thisSetting["+$suffix"] );
                                        }
@@ -295,9 +295,9 @@
         * @param array $wikiTags The tags assigned to the wiki.
         * @return array Array of settings requested.
         */
-       public function getAll( $wiki, $suffix = null, $params = array(), 
$wikiTags = array() ) {
+       public function getAll( $wiki, $suffix = null, $params = [], $wikiTags 
= [] ) {
                $params = $this->mergeParams( $wiki, $suffix, $params, 
$wikiTags );
-               $localSettings = array();
+               $localSettings = [];
                foreach ( $this->settings as $varname => $stuff ) {
                        $append = false;
                        $var = $varname;
@@ -325,8 +325,8 @@
         * @param array $wikiTags The tags assigned to the wiki.
         * @return bool The value of the setting requested.
         */
-       public function getBool( $setting, $wiki, $suffix = null, $wikiTags = 
array() ) {
-               return (bool)$this->get( $setting, $wiki, $suffix, array(), 
$wikiTags );
+       public function getBool( $setting, $wiki, $suffix = null, $wikiTags = 
[] ) {
+               return (bool)$this->get( $setting, $wiki, $suffix, [], 
$wikiTags );
        }
 
        /**
@@ -348,7 +348,7 @@
         * @param array $wikiTags The tags assigned to the wiki.
         */
        public function extractVar( $setting, $wiki, $suffix, &$var,
-               $params = array(), $wikiTags = array()
+               $params = [], $wikiTags = []
        ) {
                $value = $this->get( $setting, $wiki, $suffix, $params, 
$wikiTags );
                if ( !is_null( $value ) ) {
@@ -365,7 +365,7 @@
         * @param array $wikiTags The tags assigned to the wiki.
         */
        public function extractGlobal( $setting, $wiki, $suffix = null,
-               $params = array(), $wikiTags = array()
+               $params = [], $wikiTags = []
        ) {
                $params = $this->mergeParams( $wiki, $suffix, $params, 
$wikiTags );
                $this->extractGlobalSetting( $setting, $wiki, $params );
@@ -399,8 +399,8 @@
         * @param array $params List of parameters. $.'key' is replaced by 
$value in all returned data.
         * @param array $wikiTags The tags assigned to the wiki.
         */
-       public function extractAllGlobals( $wiki, $suffix = null, $params = 
array(),
-               $wikiTags = array()
+       public function extractAllGlobals( $wiki, $suffix = null, $params = [],
+               $wikiTags = []
        ) {
                $params = $this->mergeParams( $wiki, $suffix, $params, 
$wikiTags );
                foreach ( $this->settings as $varName => $setting ) {
@@ -420,8 +420,8 @@
                static $default = array(
                        'suffix' => null,
                        'lang' => null,
-                       'tags' => array(),
-                       'params' => array(),
+                       'tags' => [],
+                       'params' => [],
                );
 
                if ( !is_callable( $this->siteParamsCallback ) ) {
@@ -524,7 +524,7 @@
                $multi = is_array( $settings );
                $settings = (array)$settings;
                if ( $wiki === wfWikiID() ) { // $wiki is this wiki
-                       $res = array();
+                       $res = [];
                        foreach ( $settings as $name ) {
                                if ( !preg_match( '/^wg[A-Z]/', $name ) ) {
                                        throw new MWException( "Variable 
'$name' does start with 'wg'." );
@@ -542,7 +542,7 @@
                        } elseif ( !in_array( $wiki, $this->wikis ) ) {
                                throw new MWException( "No such wiki '$wiki'." 
);
                        } else {
-                               $this->cfgCache[$wiki] = array();
+                               $this->cfgCache[$wiki] = [];
                        }
                        $retVal = 1;
                        $cmd = wfShellWikiCmd(
@@ -554,7 +554,7 @@
                                )
                        );
                        // ulimit5.sh breaks this call
-                       $data = trim( wfShellExec( $cmd, $retVal, array(), 
array( 'memory' => 0 ) ) );
+                       $data = trim( wfShellExec( $cmd, $retVal, [], array( 
'memory' => 0 ) ) );
                        if ( $retVal != 0 || !strlen( $data ) ) {
                                throw new MWException( "Failed to run 
getConfiguration.php." );
                        }
diff --git a/tests/TestServices.php b/tests/TestServices.php
index 28e47cd..674988f 100644
--- a/tests/TestServices.php
+++ b/tests/TestServices.php
@@ -12,25 +12,25 @@
 # FIXME variables should be set in WgConfTestCase::loadWgConf??
 
 $wmfDatacenter = $wmfMasterDatacenter = 'unittest';
-$wmfAllServices = array();
+$wmfAllServices = [];
 
-$wmfAllServices['unittest'] = array(
+$wmfAllServices['unittest'] = [
        'udp2log' => 'localhost:8420',
        'statsd' => 'localhost',
-       'search' => array( 'localhost' ),
+       'search' => [ 'localhost' ],
        'ocg' => 'localhost',
        'urldownloader' => 'localhost',
        'parsoidcache' => 'localhost',
        'mathoid' => 'localhost',
        'eventlogging' => 'localhost',
        'eventbus' => 'localhost',
-);
+];
 
 ### Logstash
-$wmfAllServices['unittest']['logstash'] = array( '127.0.0.1' );
+$wmfAllServices['unittest']['logstash'] = [ '127.0.0.1' ];
 
 ### Analytics Kafka cluster
-$wmfAllServices['unittest']['kafka'] = array( '127.0.0.1:9092' );
+$wmfAllServices['unittest']['kafka'] = [ '127.0.0.1:9092' ];
 
 ### IRC
 $wmfAllServices['unittest']['irc'] = '127.0.0.1';
diff --git a/tests/WgConfTestCase.php b/tests/WgConfTestCase.php
index 810f981..b04fd67 100644
--- a/tests/WgConfTestCase.php
+++ b/tests/WgConfTestCase.php
@@ -12,24 +12,24 @@
 
 class WgConfTestCase extends PHPUnit_Framework_TestCase {
 
-       protected $globals = array();
-       protected $globalsToUnset = array();
+       protected $globals = [];
+       protected $globalsToUnset = [];
 
        protected function restoreGlobals() {
                foreach ( $this->globals as $key => $value ) {
                        $GLOBALS[$key] = $value;
                }
-               $this->globals = array();
+               $this->globals = [];
 
                foreach ( $this->globalsToUnset as $key ) {
                        unset( $GLOBALS[$key] );
                }
-               $this->globalsToUnset = array();
+               $this->globalsToUnset = [];
        }
 
        protected function setGlobals( $pairs, $value = null ) {
                if ( is_string( $pairs ) ) {
-                       $pairs = array( $pairs => $value );
+                       $pairs = [ $pairs => $value ];
                }
                foreach ( $pairs as $key => $value ) {
                        // only set value in $this->globals on first call
@@ -92,21 +92,21 @@
                require "{$wmfConfigDir}/wgConf.php";
 
                // InitialiseSettings.php explicitly declares these as global, 
so we must too
-               $this->setGlobals( array(
+               $this->setGlobals( [
                        'wmfUdp2logDest' => 'localhost',
                        'wmfDatacenter' => 'unittest',
                        'wmfMasterDatacenter' => 'unittest',
                        'wmfRealm' => $wmfRealm,
                        'wmfConfigDir' => $wmfConfigDir,
                        'wgConf' => $wgConf,
-               ) );
+               ] );
 
                // Other InitialiseSettings.php globals that we set in 
TestServices.php
-               $this->setGlobals( array(
+               $this->setGlobals( [
                        'wmfAllServices' => null,
                        'wmfLocalServices' => null,
                        'wmfMasterServices' => null,
-               ) );
+               ] );
                require __DIR__ . '/TestServices.php';
 
                require "{$wmfConfigDir}/InitialiseSettings.php";
diff --git a/w/extract2.php b/w/extract2.php
index 85b6709..8f5133e 100644
--- a/w/extract2.php
+++ b/w/extract2.php
@@ -5,7 +5,7 @@
 require_once __DIR__ . '/../multiversion/MWMultiVersion.php';
 require MWMultiVersion::getMediaWiki( 'includes/WebStart.php' );
 
-$allowed_templates = array(
+$allowed_templates = [
        'Www.wikimedia.org_template',
        'Www.wikipedia.org_template',
        'Www.wikinews.org_template',
@@ -15,7 +15,7 @@
        'Www.wikibooks.org_template',
        'Www.wikivoyage.org_template',
        'API_listing_template',
-);
+];
 
 $template = $wgRequest->getText( 'template', 'Www.wikipedia.org_template' );
 if ( !in_array( $template, $allowed_templates ) ) {
diff --git a/w/health-check.php b/w/health-check.php
index 5c5c8e3..e17688e 100644
--- a/w/health-check.php
+++ b/w/health-check.php
@@ -12,13 +12,13 @@
 
 # Parse cpuinfo
 $processors = explode( "\n\n", $cpuinfo );
-$ids = array();
+$ids = [];
 foreach ( $processors as $i => $processor ) {
        if ( trim( $processor ) == '' ) {
                continue;
        }
        $lines = explode( "\n", $processor );
-       $props = array();
+       $props = [];
        foreach ( $lines as $line ) {
                list( $name, $value ) = array_map( 'trim', explode( ':', $line, 
2 ) );
                $props[$name] = $value;
diff --git a/wmf-config/CirrusSearch-labs.php b/wmf-config/CirrusSearch-labs.php
index 0fc8ba5..97824a3 100644
--- a/wmf-config/CirrusSearch-labs.php
+++ b/wmf-config/CirrusSearch-labs.php
@@ -29,7 +29,7 @@
 # Override prod configuration, there is only one cluster in beta
 $wgCirrusSearchDefaultCluster = 'eqiad';
 # Don't specially configure cluster for more like queries in beta
-$wgCirrusSearchFullTextClusterOverrides = array();
+$wgCirrusSearchFullTextClusterOverrides = [];
 # write to all configured clusters, there should only be one in labs
 $wgCirrusSearchWriteClusters = null;
 
diff --git a/wmf-config/InitialiseSettings.php 
b/wmf-config/InitialiseSettings.php
index 4210768..6d7302b 100644
--- a/wmf-config/InitialiseSettings.php
+++ b/wmf-config/InitialiseSettings.php
@@ -5042,8 +5042,8 @@
 // Configure Monolog logging to udp2log, Logstash and/or kafka
 // channel => false  == ignore all log events on this channel
 // channel => level  == record all events of this level or higher
-// channel => array( 'udp2log'=>level, 'logstash'=>level, 'kafka'=>level, 
'sample'=>rate )
-// Defaults: array( 'udp2log'=>'debug', 'logstash'=>'info', 'kafka'=>false, 
'sample'=>false )
+// channel => [ 'udp2log'=>level, 'logstash'=>level, 'kafka'=>level, 
'sample'=>rate ]
+// Defaults: [ 'udp2log'=>'debug', 'logstash'=>'info', 'kafka'=>false, 
'sample'=>false ]
 // Valid levels: 'debug', 'info', 'warning', 'error', false
 // Note: sampled logs will not be sent to Logstash
 // Note: Udp2log events are sent to udp://{$wmfUdp2logDest}/{$channel}
@@ -6612,10 +6612,10 @@
                113 => 'Subject_talk',
        ],
        /*
-       'eswikibooks' => array(
+       'eswikibooks' => [
                //102 => 'Wikiversidad',            // T42838 (ns removed)
                //103 => 'Wikiversidad_Discusión',
-       ),
+       ],
        */
        'fawikibooks' => [
                102 => 'کتاب‌آشپزی',
@@ -7424,12 +7424,12 @@
        'bswiki' => false, // T158662
 ],
 
-'wgUseFilePatrol' => array(
+'wgUseFilePatrol' => [
        'default' => true,
        'huwiki' => false, // T21241
        'ruwiki' => false, // T154285
        'bswiki' => false, // T158662
-),
+],
 
 # wgNoFollow... @{
 'wgNoFollowLinks' => [
@@ -7659,7 +7659,7 @@
                ],
                // For expanded rollback permissions...
                'rollback' => [
-                       'user' => [ 10, 60 ], // was array( 5, 60 ), -- brion 
2008-05-15
+                       'user' => [ 10, 60 ], // was [ 5, 60 ], -- brion 
2008-05-15
                        'newbie' => [ 5, 120 ],
                        // practicality has won out over paranoia on enwiki, 
raising from 20 to 100 -- TS 2008-05-21
                        'rollbacker' => [ 100, 60 ],
@@ -8222,8 +8222,8 @@
                'patroller' => [ 'patrol' => true ], // T149019
        ],
        '+enwikibooks' => [
-               // 'rollbacker' => array( 'rollback' => true ),
-               // 'patroller' => array( 'patrol' => true, 'autopatrol' => true 
),
+               // 'rollbacker' => [ 'rollback' => true ],
+               // 'patroller' => [ 'patrol' => true, 'autopatrol' => true ],
                'flood' => [ 'bot' => true ],
                'uploader' => [ 'upload' => true, 'reupload' => true ],
        ],
@@ -8906,7 +8906,7 @@
                ],
        ],
        '+nlwikibooks' => [ 'user' => [ 'patrol' => true ] ],
-       // 'nlwikinews' => array( 'user' => array( 'patrol' => true ) ),
+       // 'nlwikinews' => [ 'user' => [ 'patrol' => true ] ],
        '+nnwiki' => [
                'autopatrolled' => [ 'autopatrol' => true ],
                'patroller' => [ 'autopatrol' => true, 'patrol' => true, 
'rollback' => true ],

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7657cc9a9fc061858feaa2911e72cda5e8086e6c
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
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