Clean up array() syntax in docs, part III
authorAmir Sarabadani <Ladsgroup@gmail.com>
Sat, 13 Aug 2016 01:10:40 +0000 (05:40 +0430)
committerAmir Sarabadani <Ladsgroup@gmail.com>
Sat, 13 Aug 2016 01:10:40 +0000 (05:40 +0430)
Also fixing some typos here and there

Change-Id: I29c29acf87f84ba9993ba75ebf2ad8091d981574

includes/cache/BacklinkCache.php
includes/db/Database.php
includes/exception/MWException.php
includes/filerepo/RepoGroup.php
includes/objectcache/ObjectCache.php
includes/pager/IndexPager.php
includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderContext.php
includes/resourceloader/ResourceLoaderFileModule.php
includes/resourceloader/ResourceLoaderImage.php

index 361fe23..8c2a19e 100644 (file)
@@ -48,7 +48,7 @@ class BacklinkCache {
         *  > (string) links table name
         *   > (int) batch size
         *    > 'numRows' : Number of rows for this link table
-        *    > 'batches' : array( $start, $end )
+        *    > 'batches' : [ $start, $end ]
         *
         * @see BacklinkCache::partitionResult()
         *
index 4e358d4..5023acd 100644 (file)
@@ -1864,7 +1864,7 @@ abstract class DatabaseBase implements IDatabase {
        /**
         * Gets an array of aliased table names
         *
-        * @param array $tables Array( [alias] => table )
+        * @param array $tables [ [alias] => table ]
         * @return string[] See tableNameWithAlias()
         */
        public function tableNamesWithAlias( $tables ) {
@@ -1898,7 +1898,7 @@ abstract class DatabaseBase implements IDatabase {
        /**
         * Gets an array of aliased field names
         *
-        * @param array $fields Array( [alias] => field )
+        * @param array $fields [ [alias] => field ]
         * @return string[] See fieldNameWithAlias()
         */
        public function fieldNamesWithAlias( $fields ) {
index bebd915..0a174fe 100644 (file)
@@ -91,7 +91,7 @@ class MWException extends Exception {
                                is_string( $hook ) ||
                                ( is_array( $hook ) && count( $hook ) >= 2 && is_string( $hook[0] ) )
                        ) {
-                               // 'function' or array( 'class', hook' )
+                               // 'function' or [ 'class', 'hook' ]
                                $result = call_user_func_array( $hook, $callargs );
                        } else {
                                $result = null;
index 08a40eb..d515b05 100644 (file)
@@ -177,8 +177,8 @@ class RepoGroup {
         * @param array $inputItems An array of titles, or an array of findFile() options with
         *    the "title" option giving the title. Example:
         *
-        *     $findItem = array( 'title' => $title, 'private' => true );
-        *     $findBatch = array( $findItem );
+        *     $findItem = [ 'title' => $title, 'private' => true ];
+        *     $findBatch = [ $findItem ];
         *     $repo->findFiles( $findBatch );
         *
         *    No title should appear in $items twice, as the result use titles as keys
index 1083393..bcdf62f 100644 (file)
@@ -249,7 +249,7 @@ class ObjectCache {
         *     ObjectCache::getLocalServerInstance( $fallbackType );
         *
         *     // From $wgObjectCaches via newFromParams()
-        *     ObjectCache::getLocalServerInstance( array( 'fallback' => $fallbackType ) );
+        *     ObjectCache::getLocalServerInstance( [ 'fallback' => $fallbackType ] );
         *
         * @param int|string|array $fallback Fallback cache or parameter map with 'fallback'
         * @return BagOStuff
index 393644f..a96ca87 100644 (file)
@@ -700,8 +700,8 @@ abstract class IndexPager extends ContextSource implements Pager {
         * not be used in the pager offset or in any links for users.
         *
         * If getIndexField() returns an array of 'querykey' => 'indexfield' pairs then
-        * this must return a corresponding array of 'querykey' => array( fields...) pairs
-        * in order for a request with &count=querykey to use array( fields...) to sort.
+        * this must return a corresponding array of 'querykey' => [ fields... ] pairs
+        * in order for a request with &count=querykey to use [ fields... ] to sort.
         *
         * This is useful for pagers that GROUP BY a unique column (say page_id)
         * and ORDER BY another (say page_len). Using GROUP BY and ORDER BY both on
index d145566..6426fea 100644 (file)
@@ -60,13 +60,13 @@ class ResourceLoader implements LoggerAwareInterface {
 
        /**
         * Associative array mapping framework ids to a list of names of test suite modules
-        * like array( 'qunit' => array( 'mediawiki.tests.qunit.suites', 'ext.foo.tests', .. ), .. )
+        * like [ 'qunit' => [ 'mediawiki.tests.qunit.suites', 'ext.foo.tests', ... ], ... ]
         * @var array
         */
        protected $testModuleNames = [];
 
        /**
-        * E.g. array( 'source-id' => 'http://.../load.php' )
+        * E.g. [ 'source-id' => 'http://.../load.php' ]
         * @var array
         */
        protected $sources = [];
@@ -433,7 +433,7 @@ class ResourceLoader implements LoggerAwareInterface {
         *
         * Source IDs are typically the same as the Wiki ID or database name (e.g. lowercase a-z).
         *
-        * @param array|string $id Source ID (string), or array( id1 => loadUrl, id2 => loadUrl, ... )
+        * @param array|string $id Source ID (string), or [ id1 => loadUrl, id2 => loadUrl, ... ]
         * @param string|array $loadUrl load.php url (string), or array with loadUrl key for
         *  backwards-compatibility.
         * @throws MWException
@@ -573,7 +573,7 @@ class ResourceLoader implements LoggerAwareInterface {
        /**
         * Get the list of sources.
         *
-        * @return array Like array( id => load.php url, .. )
+        * @return array Like [ id => load.php url, ... ]
         */
        public function getSources() {
                return $this->sources;
@@ -1173,7 +1173,7 @@ MESSAGE;
         *    - ResourceLoader::makeLoaderStateScript( $name, $state ):
         *         Set the state of a single module called $name to $state
         *
-        *    - ResourceLoader::makeLoaderStateScript( array( $name => $state, ... ) ):
+        *    - ResourceLoader::makeLoaderStateScript( [ $name => $state, ... ] ):
         *         Set the state of modules with the given names to the given states
         *
         * @param string $name
@@ -1264,14 +1264,14 @@ MESSAGE;
         *     ):
         *        Register a single module.
         *
-        *   - ResourceLoader::makeLoaderRegisterScript( array( $name1, $name2 ) ):
+        *   - ResourceLoader::makeLoaderRegisterScript( [ $name1, $name2 ] ):
         *        Register modules with the given names.
         *
-        *   - ResourceLoader::makeLoaderRegisterScript( array(
-        *        array( $name1, $version1, $dependencies1, $group1, $source1, $skip1 ),
-        *        array( $name2, $version2, $dependencies1, $group2, $source2, $skip2 ),
+        *   - ResourceLoader::makeLoaderRegisterScript( [
+        *        [ $name1, $version1, $dependencies1, $group1, $source1, $skip1 ],
+        *        [ $name2, $version2, $dependencies1, $group2, $source2, $skip2 ],
         *        ...
-        *     ) ):
+        *     ] ):
         *        Registers modules with the given names and parameters.
         *
         * @param string $name Module name
@@ -1329,7 +1329,7 @@ MESSAGE;
         *   - ResourceLoader::makeLoaderSourcesScript( $id, $properties ):
         *       Register a single source
         *
-        *   - ResourceLoader::makeLoaderSourcesScript( array( $id1 => $loadUrl, $id2 => $loadUrl, ... ) );
+        *   - ResourceLoader::makeLoaderSourcesScript( [ $id1 => $loadUrl, $id2 => $loadUrl, ... ] );
         *       Register sources with the given IDs and properties.
         *
         * @param string $id Source ID
@@ -1402,13 +1402,13 @@ MESSAGE;
        /**
         * Convert an array of module names to a packed query string.
         *
-        * For example, array( 'foo.bar', 'foo.baz', 'bar.baz', 'bar.quux' )
+        * For example, [ 'foo.bar', 'foo.baz', 'bar.baz', 'bar.quux' ]
         * becomes 'foo.bar,baz|bar.baz,quux'
         * @param array $modules List of module names (strings)
         * @return string Packed query string
         */
        public static function makePackedModulesString( $modules ) {
-               $groups = []; // array( prefix => array( suffixes ) )
+               $groups = []; // [ prefix => [ suffixes ] ]
                foreach ( $modules as $module ) {
                        $pos = strrpos( $module, '.' );
                        $prefix = $pos === false ? '' : substr( $module, 0, $pos );
index 8fa0411..79b71df 100644 (file)
@@ -91,8 +91,8 @@ class ResourceLoaderContext {
 
        /**
         * Expand a string of the form jquery.foo,bar|jquery.ui.baz,quux to
-        * an array of module names like array( 'jquery.foo', 'jquery.bar',
-        * 'jquery.ui.baz', 'jquery.ui.quux' )
+        * an array of module names like [ 'jquery.foo', 'jquery.bar',
+        * 'jquery.ui.baz', 'jquery.ui.quux' ]
         * @param string $modules Packed module name list
         * @return array Array of module names
         */
@@ -113,7 +113,7 @@ class ResourceLoaderContext {
                                } else {
                                        // We have a prefix and a bunch of suffixes
                                        $prefix = substr( $group, 0, $pos ); // 'foo'
-                                       $suffixes = explode( ',', substr( $group, $pos + 1 ) ); // array( 'bar', 'baz' )
+                                       $suffixes = explode( ',', substr( $group, $pos + 1 ) ); // [ 'bar', 'baz' ]
                                        foreach ( $suffixes as $suffix ) {
                                                $retval[] = "$prefix.$suffix";
                                        }
index 2816126..574e535 100644 (file)
@@ -41,7 +41,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         * @var array List of paths to JavaScript files to always include
         * @par Usage:
         * @code
-        * array( [file-path], [file-path], ... )
+        * [ [file-path], [file-path], ... ]
         * @endcode
         */
        protected $scripts = [];
@@ -50,7 +50,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         * @var array List of JavaScript files to include when using a specific language
         * @par Usage:
         * @code
-        * array( [language-code] => array( [file-path], [file-path], ... ), ... )
+        * [ [language-code] => [ [file-path], [file-path], ... ], ... ]
         * @endcode
         */
        protected $languageScripts = [];
@@ -59,7 +59,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         * @var array List of JavaScript files to include when using a specific skin
         * @par Usage:
         * @code
-        * array( [skin-name] => array( [file-path], [file-path], ... ), ... )
+        * [ [skin-name] => [ [file-path], [file-path], ... ], ... ]
         * @endcode
         */
        protected $skinScripts = [];
@@ -68,7 +68,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         * @var array List of paths to JavaScript files to include in debug mode
         * @par Usage:
         * @code
-        * array( [skin-name] => array( [file-path], [file-path], ... ), ... )
+        * [ [skin-name] => [ [file-path], [file-path], ... ], ... ]
         * @endcode
         */
        protected $debugScripts = [];
@@ -77,7 +77,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         * @var array List of paths to CSS files to always include
         * @par Usage:
         * @code
-        * array( [file-path], [file-path], ... )
+        * [ [file-path], [file-path], ... ]
         * @endcode
         */
        protected $styles = [];
@@ -86,7 +86,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         * @var array List of paths to CSS files to include when using specific skins
         * @par Usage:
         * @code
-        * array( [file-path], [file-path], ... )
+        * [ [file-path], [file-path], ... ]
         * @endcode
         */
        protected $skinStyles = [];
@@ -95,7 +95,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         * @var array List of modules this module depends on
         * @par Usage:
         * @code
-        * array( [file-path], [file-path], ... )
+        * [ [file-path], [file-path], ... ]
         * @endcode
         */
        protected $dependencies = [];
@@ -109,7 +109,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         * @var array List of message keys used by this module
         * @par Usage:
         * @code
-        * array( [message-key], [message-key], ... )
+        * [ [message-key], [message-key], ... ]
         * @endcode
         */
        protected $messages = [];
@@ -138,7 +138,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         * @var array Place where readStyleFile() tracks file dependencies
         * @par Usage:
         * @code
-        * array( [file-path], [file-path], ... )
+        * [ [file-path], [file-path], ... ]
         * @endcode
         */
        protected $localFileRefs = [];
@@ -165,7 +165,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         * @throws InvalidArgumentException
         * @par Construction options:
         * @code
-        *     array(
+        *     [
         *         // Base path to prepend to all local paths in $options. Defaults to $IP
         *         'localBasePath' => [base path],
         *         // Base path to prepend to all remote paths in $options. Defaults to $wgResourceBasePath
@@ -207,7 +207,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         *         // The file must contain valid JavaScript for execution in a private function.
         *         // The file must not contain the "function () {" and "}" wrapper though.
         *         'skipFunction' => [file path]
-        *     )
+        *     ]
         * @endcode
         */
        public function __construct(
index 87e5fd7..2503b22 100644 (file)
@@ -54,8 +54,8 @@ class ResourceLoaderImage {
                $this->variants = $variants;
 
                // Expand shorthands:
-               // array( "en,de,fr" => "foo.svg" )
-               // → array( "en" => "foo.svg", "de" => "foo.svg", "fr" => "foo.svg" )
+               // [ "en,de,fr" => "foo.svg" ]
+               // → [ "en" => "foo.svg", "de" => "foo.svg", "fr" => "foo.svg" ]
                if ( is_array( $this->descriptor ) && isset( $this->descriptor['lang'] ) ) {
                        foreach ( array_keys( $this->descriptor['lang'] ) as $langList ) {
                                if ( strpos( $langList, ',' ) !== false ) {