Clean up array() syntax in docs, part II
authorAmir Sarabadani <Ladsgroup@gmail.com>
Sun, 7 Aug 2016 10:27:38 +0000 (14:57 +0430)
committerAmir Sarabadani <Ladsgroup@gmail.com>
Sun, 7 Aug 2016 10:27:38 +0000 (14:57 +0430)
Change-Id: I226ce6bcb5bbf6ed3802042dd2790f85617833e1

includes/CategoryFinder.php
includes/api/ApiPageSet.php
includes/api/ApiResult.php
includes/db/DatabaseMssql.php
includes/db/DatabasePostgres.php
includes/db/IDatabase.php
includes/db/loadbalancer/LBFactoryMulti.php
includes/db/loadbalancer/LoadBalancer.php
includes/utils/BatchRowIterator.php

index 3f0528e..3d5e6c5 100644 (file)
@@ -33,8 +33,8 @@
  *
  *     $cf = new CategoryFinder;
  *     $cf->seed(
- *         array( 12345 ),
- *         array( 'Category 1', 'Category 2' ),
+ *         [ 12345 ],
+ *         [ 'Category 1', 'Category 2' ],
  *         'AND'
  *     );
  *     $a = $cf->run();
@@ -49,7 +49,7 @@ class CategoryFinder {
        /** @var array Array of DBKEY category names for categories that don't have a page */
        protected $deadend = [];
 
-       /** @var array Array of [ID => array()] */
+       /** @var array Array of [ ID => [] ] */
        protected $parents = [];
 
        /** @var array Array of article/category IDs */
index 8045447..90438d4 100644 (file)
@@ -1002,7 +1002,7 @@ class ApiPageSet extends ApiBase {
                                // Get pageIDs data from the `page` table
                                $res = $db->select( 'page', $pageFlds, $set, __METHOD__ );
 
-                               // Hack: get the ns:titles stored in array(ns => array(titles)) format
+                               // Hack: get the ns:titles stored in [ns => array(titles)] format
                                $this->initFromQueryResult( $res, $linkBatch->data, true );
                        }
                }
index 3a4b012..00846f5 100644 (file)
@@ -20,7 +20,7 @@
 
 /**
  * This class represents the result of the API operations.
- * It simply wraps a nested array() structure, adding some functions to simplify
+ * It simply wraps a nested array structure, adding some functions to simplify
  * array's modifications. As various modules execute, they add different pieces
  * of information to this result, structuring it as it will be given to the client.
  *
index 33f8162..5e0365a 100644 (file)
@@ -378,10 +378,10 @@ class DatabaseMssql extends Database {
         * @param mixed $conds Array or string, condition(s) for WHERE
         * @param string $fname Calling function name (use __METHOD__) for logs/profiling
         * @param array $options Associative array of options (e.g.
-        *   array('GROUP BY' => 'page_title')), see Database::makeSelectOptions
+        *   [ 'GROUP BY' => 'page_title' ]), see Database::makeSelectOptions
         *   code for list of supported stuff
         * @param array $join_conds Associative array of table join conditions
-        *   (optional) (e.g. array( 'page' => array('LEFT JOIN','page_latest=rev_id') )
+        *   (optional) (e.g. [ 'page' => [ 'LEFT JOIN','page_latest=rev_id' ] ]
         * @return mixed Database result resource (feed to Database::fetchObject
         *   or whatever), or false on failure
         * @throws DBQueryError
@@ -434,10 +434,10 @@ class DatabaseMssql extends Database {
         * @param mixed $vars Array or string, field name(s) to be retrieved
         * @param mixed $conds Array or string, condition(s) for WHERE
         * @param string $fname Calling function name (use __METHOD__) for logs/profiling
-        * @param array $options Associative array of options (e.g. array('GROUP BY' => 'page_title')),
+        * @param array $options Associative array of options (e.g. [ 'GROUP BY' => 'page_title' ]),
         *   see Database::makeSelectOptions code for list of supported stuff
         * @param array $join_conds Associative array of table join conditions (optional)
-        *    (e.g. array( 'page' => array('LEFT JOIN','page_latest=rev_id') )
+        *    (e.g. [ 'page' => [ 'LEFT JOIN','page_latest=rev_id' ] ]
         * @return string The SQL text
         */
        public function selectSQLText( $table, $vars, $conds = '', $fname = __METHOD__,
@@ -717,7 +717,7 @@ class DatabaseMssql extends Database {
 
        /**
         * INSERT SELECT wrapper
-        * $varMap must be an associative array of the form array( 'dest1' => 'source1', ...)
+        * $varMap must be an associative array of the form [ 'dest1' => 'source1', ... ]
         * Source items may be literals rather than field names, but strings should
         * be quoted with Database::addQuotes().
         * @param string $destTable
index c9127ff..867aeb8 100644 (file)
@@ -888,7 +888,7 @@ __INDEXATTR__;
 
        /**
         * INSERT SELECT wrapper
-        * $varMap must be an associative array of the form array( 'dest1' => 'source1', ...)
+        * $varMap must be an associative array of the form [ 'dest1' => 'source1', ... ]
         * Source items may be literals rather then field names, but strings should
         * be quoted with Database::addQuotes()
         * $conds may be "*" to copy the whole table
index 41b131f..9dcbd7f 100644 (file)
@@ -329,7 +329,7 @@ interface IDatabase {
         *
         * Example:
         * $id = $dbw->nextSequenceValue( 'page_page_id_seq' );
-        * $dbw->insert( 'page', array( 'page_id' => $id ) );
+        * $dbw->insert( 'page', [ 'page_id' => $id ] );
         * $id = $dbw->insertId();
         *
         * @return int
@@ -519,7 +519,7 @@ interface IDatabase {
         * May be either an array of table names, or a single string holding a table
         * name. If an array is given, table aliases can be specified, for example:
         *
-        *    array( 'a' => 'user' )
+        *    [ 'a' => 'user' ]
         *
         * This includes the user table in the query, with the alias "a" available
         * for use in field names (e.g. a.user_name).
@@ -537,7 +537,7 @@ interface IDatabase {
         * can be complete fragments of SQL, for direct inclusion into the SELECT
         * query. If an array is given, field aliases can be specified, for example:
         *
-        *   array( 'maxrev' => 'MAX(rev_id)' )
+        *   [ 'maxrev' => 'MAX(rev_id)' ]
         *
         * This includes an expression with the alias "maxrev" in the query.
         *
@@ -582,7 +582,7 @@ interface IDatabase {
         * including them in the array as a string value with a numeric key, for
         * example:
         *
-        *    array( 'FOR UPDATE' )
+        *    [ 'FOR UPDATE' ]
         *
         * The supported options are:
         *
@@ -644,7 +644,7 @@ interface IDatabase {
         * an SQL fragment, or an array where the string keys are equality and the
         * numeric keys are SQL fragments all AND'd together. For example:
         *
-        *    array( 'page' => array( 'LEFT JOIN', 'page_latest=rev_id' ) )
+        *    [ 'page' => [ 'LEFT JOIN', 'page_latest=rev_id' ] ]
         *
         * @return ResultWrapper|bool If the query returned no rows, a ResultWrapper
         *   with no rows in it will be returned. If there was a query error, a
@@ -857,7 +857,7 @@ interface IDatabase {
         * The keys on each level may be either integers or strings.
         *
         * @param array $data Organized as 2-d
-        *    array(baseKeyVal => array(subKeyVal => [ignored], ...), ...)
+        *    [ baseKeyVal => [ subKeyVal => [ignored], ... ], ... ]
         * @param string $baseKey Field name to match the base-level keys to (eg 'pl_namespace')
         * @param string $subKey Field name to match the sub-level keys to (eg 'pl_title')
         * @return string|bool SQL fragment, or false if no items in array
@@ -950,7 +950,7 @@ interface IDatabase {
         * Example: $dbr->buildLike( 'My_page_title/', $dbr->anyString() ) returns
         * a LIKE clause that searches for subpages of 'My page title'.
         * Alternatively:
-        *   $pattern = array( 'My_page_title/', $dbr->anyString() );
+        *   $pattern = [ 'My_page_title/', $dbr->anyString() ];
         *   $query .= $dbr->buildLike( $pattern );
         *
         * @since 1.16
@@ -1092,7 +1092,7 @@ interface IDatabase {
         *    to include in a join.
         *
         * @param array $varMap Must be an associative array of the form
-        *    array( 'dest1' => 'source1', ...). Source items may be literals
+        *    [ 'dest1' => 'source1', ... ]. Source items may be literals
         *    rather than field names, but strings should be quoted with
         *    IDatabase::addQuotes()
         *
index 3a543ac..32b1a0f 100644 (file)
  *
  *     sectionLoads                A 2-d map. For each section, gives a map of server names to
  *                                 load ratios. For example:
- *                                 array(
- *                                     'section1' => array(
+ *                                 [
+ *                                     'section1' => [
  *                                         'db1' => 100,
  *                                         'db2' => 100
- *                                     )
- *                                 )
+ *                                     ]
+ *                                 ]
  *
  *     serverTemplate              A server info associative array as documented for $wgDBservers.
  *                                 The host, hostName and load entries will be overridden.
  *
  *     groupLoadsBySection         A 3-d map giving server load ratios for each section and group.
  *                                 For example:
- *                                 array(
- *                                     'section1' => array(
- *                                         'group1' => array(
+ *                                 [
+ *                                     'section1' => [
+ *                                         'group1' => [
  *                                             'db1' => 100,
  *                                             'db2' => 100
- *                                         )
- *                                     )
- *                                 )
+ *                                         ]
+ *                                     ]
+ *                                 ]
  *
  *     groupLoadsByDB              A 3-d map giving server load ratios by DB name.
  *
index b44b559..1269c3e 100644 (file)
@@ -617,7 +617,7 @@ class LoadBalancer {
                        /**
                         * This can happen in code like:
                         *   foreach ( $dbs as $db ) {
-                        *     $conn = $lb->getConnection( DB_SLAVE, array(), $db );
+                        *     $conn = $lb->getConnection( DB_SLAVE, [], $db );
                         *     ...
                         *     $lb->reuseConnection( $conn );
                         *   }
index c7bd395..9fc2431 100644 (file)
@@ -217,7 +217,7 @@ class BatchRowIterator implements RecursiveIterator {
         * `=` conditions while the final key uses a `>` condition
         *
         * Example output:
-        *        array( '( foo = 42 AND bar > 7 ) OR ( foo > 42 )' )
+        *        [ '( foo = 42 AND bar > 7 ) OR ( foo > 42 )' ]
         *
         * @return array The SQL conditions necessary to select the next set
         *  of rows in the batched query