From: Amir Sarabadani Date: Sun, 7 Aug 2016 10:27:38 +0000 (+0430) Subject: Clean up array() syntax in docs, part II X-Git-Tag: 1.31.0-rc.0~6136 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=8771ae98720eadfe95cdaf134e3dc2ca06526309;p=lhc%2Fweb%2Fwiklou.git Clean up array() syntax in docs, part II Change-Id: I226ce6bcb5bbf6ed3802042dd2790f85617833e1 --- diff --git a/includes/CategoryFinder.php b/includes/CategoryFinder.php index 3f0528ebe0..3d5e6c58ab 100644 --- a/includes/CategoryFinder.php +++ b/includes/CategoryFinder.php @@ -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 */ diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index 8045447822..90438d4366 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -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 ); } } diff --git a/includes/api/ApiResult.php b/includes/api/ApiResult.php index 3a4b012c30..00846f52ed 100644 --- a/includes/api/ApiResult.php +++ b/includes/api/ApiResult.php @@ -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. * diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php index 33f81623d9..5e0365a2d8 100644 --- a/includes/db/DatabaseMssql.php +++ b/includes/db/DatabaseMssql.php @@ -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 diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index c9127ff599..867aeb8705 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -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 diff --git a/includes/db/IDatabase.php b/includes/db/IDatabase.php index 41b131f40b..9dcbd7f278 100644 --- a/includes/db/IDatabase.php +++ b/includes/db/IDatabase.php @@ -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() * diff --git a/includes/db/loadbalancer/LBFactoryMulti.php b/includes/db/loadbalancer/LBFactoryMulti.php index 3a543acc5b..32b1a0f942 100644 --- a/includes/db/loadbalancer/LBFactoryMulti.php +++ b/includes/db/loadbalancer/LBFactoryMulti.php @@ -38,26 +38,26 @@ * * 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. * diff --git a/includes/db/loadbalancer/LoadBalancer.php b/includes/db/loadbalancer/LoadBalancer.php index b44b559b9e..1269c3e4ee 100644 --- a/includes/db/loadbalancer/LoadBalancer.php +++ b/includes/db/loadbalancer/LoadBalancer.php @@ -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 ); * } diff --git a/includes/utils/BatchRowIterator.php b/includes/utils/BatchRowIterator.php index c7bd395b5d..9fc243120a 100644 --- a/includes/utils/BatchRowIterator.php +++ b/includes/utils/BatchRowIterator.php @@ -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