* Merge arrays in the style of getUserPermissionsErrors, with duplicate removal
* e.g.
* wfMergeErrorArrays(
- * array( array( 'x' ) ),
- * array( array( 'x', '2' ) ),
- * array( array( 'x' ) ),
- * array( array( 'y' ) )
+ * [ [ 'x' ] ],
+ * [ [ 'x', '2' ] ],
+ * [ [ 'x' ] ],
+ * [ [ 'y' ] ]
* );
* returns:
- * array(
- * array( 'x', '2' ),
- * array( 'x' ),
- * array( 'y' )
- * )
+ * [
+ * [ 'x', '2' ],
+ * [ 'x' ],
+ * [ 'y' ]
+ * ]
*
* @param array $array1,...
* @return array
$bits = parse_url( $url );
MediaWiki\restoreWarnings();
// parse_url() returns an array without scheme for some invalid URLs, e.g.
- // parse_url("%0Ahttp://example.com") == array( 'host' => '%0Ahttp', 'path' => 'example.com' )
+ // parse_url("%0Ahttp://example.com") == [ 'host' => '%0Ahttp', 'path' => 'example.com' ]
if ( !$bits || !isset( $bits['scheme'] ) ) {
return false;
}
*
* @code
* $conf = new SiteConfiguration;
- * $conf->wikis = array( 'de', 'en', 'beta' );
+ * $conf->wikis = [ 'de', 'en', 'beta' ];
* @endcode
*
* When configuring the MediaWiki global settings (the $wg variables),
* the identifiers will be available to specify settings on a per wiki basis.
*
* @code
- * $conf->settings = array(
- * 'wgSomeSetting' => array(
+ * $conf->settings = [
+ * 'wgSomeSetting' => [
*
* # production:
* 'de' => false,
*
* # test:
* 'beta => true,
- * ),
- * );
+ * ],
+ * ];
* @endcode
*
* With three wikis, that is easy to manage. But what about a farm with
* the above code could be written:
*
* @code
- * $conf->settings = array(
- * 'wgSomeSetting' => array(
+ * $conf->settings = [
+ * 'wgSomeSetting' => [
*
* 'default' => false,
*
* # Enable feature on test
* 'beta' => true,
- * ),
- * );
+ * ],
+ * ];
* @endcode
*
*
* on a per wiki basis.
*
* @code
- * $conf->settings = array(
- * 'wgMergeSetting' = array(
+ * $conf->settings = [
+ * 'wgMergeSetting' = [
* # Value that will be shared among all wikis:
- * 'default' => array( NS_USER => true ),
+ * 'default' => [ NS_USER => true ],
*
* # Leading '+' means merging the array of value with the defaults
- * '+beta' => array( NS_HELP => true ),
- * ),
- * );
+ * '+beta' => [ NS_HELP => true ],
+ * ],
+ * ];
*
* # Get configuration for the German site:
* $conf->get( 'wgMergeSetting', 'de' );
- * // --> array( NS_USER => true );
+ * // --> [ NS_USER => true ];
*
* # Get configuration for the testing site:
* $conf->get( 'wgMergeSetting', 'beta' );
- * // --> array( NS_USER => true, NS_HELP => true );
+ * // --> [ NS_USER => true, NS_HELP => true ];
* @endcode
*
* Finally, to load all configuration settings, extract them in global context:
*
* @todo Give examples for,
* suffixes:
- * $conf->suffixes = array( 'wiki' );
+ * $conf->suffixes = [ 'wiki' ];
* localVHosts
* callbacks!
*/
/**
* Return the error message related to a certain array
* @param array|string|MessageSpecifier $error Element of a getUserPermissionsErrors()-style array
- * @return array('code' => code, 'info' => info)
+ * @return [ 'code' => code, 'info' => info ]
*/
public function parseMsg( $error ) {
// Check whether someone passed the whole array, instead of one element as
/**
* Fetch continuation result data
- * @return array Array( (array)$data, (bool)$batchcomplete )
+ * @return array [ (array)$data, (bool)$batchcomplete ]
*/
public function getContinuation() {
$data = [];
// @codingStandardsIgnoreStart String contenation on "msg" not allowed to break long line
/**
* List of user roles that are specifically relevant to the API.
- * array( 'right' => array ( 'msg' => 'Some message with a $1',
- * 'params' => array ( $someVarToSubst ) ),
- * );
+ * [ 'right' => [ 'msg' => 'Some message with a $1',
+ * 'params' => [ $someVarToSubst ] ],
+ * ];
*/
private static $mRights = [
'writeapi' => [
*
* @code
* $modules['foo'] = 'ApiFoo';
- * $modules['bar'] = array(
+ * $modules['bar'] = [
* 'class' => 'ApiBar',
* 'factory' => function( $main, $name ) { ... }
- * );
- * $modules['xyzzy'] = array(
+ * ];
+ * $modules['xyzzy'] = [
* 'class' => 'ApiXyzzy',
- * 'factory' => array( 'XyzzyFactory', 'newApiModule' )
- * );
+ * 'factory' => [ 'XyzzyFactory', 'newApiModule' ]
+ * ];
* @endcode
*
* @param array $modules A map of ModuleName => ModuleSpec; The ModuleSpec
private $mGoodTitles = [];
private $mMissingPages = []; // [ns][dbkey] => fake page_id
private $mMissingTitles = [];
- /** @var array [fake_page_id] => array( 'title' => $title, 'invalidreason' => $reason ) */
+ /** @var array [fake_page_id] => [ 'title' => $title, 'invalidreason' => $reason ] */
private $mInvalidTitles = [];
private $mMissingPageIDs = [];
private $mRedirectTitles = [];
$res = $db->select( 'page', $this->getPageTableFields(), $set,
__METHOD__ );
- // Hack: get the ns:titles stored in array(ns => array(titles)) format
+ // Hack: get the ns:titles stored in [ ns => [ titles ] ] format
$this->initFromQueryResult( $res, $linkBatch->data, true ); // process Titles
// Resolve any found redirects
/**
* Add a set of JOIN conditions to the internal array
*
- * JOIN conditions are formatted as array( tablename => array(jointype,
- * conditions) e.g. array('page' => array('LEFT JOIN',
- * 'page_id=rev_page')) . conditions may be a string or an
- * addWhere()-style array
+ * JOIN conditions are formatted as [ tablename => [ jointype, conditions ] ]
+ * e.g. [ 'page' => [ 'LEFT JOIN', 'page_id=rev_page' ] ].
+ * Conditions may be a string or an addWhere()-style array.
* @param array $join_conds JOIN conditions
*/
protected function addJoinConds( $join_conds ) {
/**
* Add a set of WHERE clauses to the internal array.
- * Clauses can be formatted as 'foo=bar' or array('foo' => 'bar'),
+ * Clauses can be formatted as 'foo=bar' or [ 'foo' => 'bar' ],
* the latter only works if the value is a constant (i.e. not another field)
*
* If $value is an empty array, this function does nothing.
*
- * For example, array('foo=bar', 'baz' => 3, 'bla' => 'foo') translates
+ * For example, [ 'foo=bar', 'baz' => 3, 'bla' => 'foo' ] translates
* to "foo=bar AND baz='3' AND bla='foo'"
* @param string|array $value
*/
* @param string $method Function the query should be attributed to.
* You should usually use __METHOD__ here
* @param array $extraQuery Query data to add but not store in the object
- * Format is array(
+ * Format is [
* 'tables' => ...,
* 'fields' => ...,
* 'where' => ...,
* 'options' => ...,
* 'join_conds' => ...
- * )
+ * ]
* @return ResultWrapper
*/
protected function select( $method, $extraQuery = [] ) {
}
// find all files with the hashes, result format is:
- // array( hash => array( dup1, dup2 ), hash1 => ... )
+ // [ hash => [ dup1, dup2 ], hash1 => ... ]
$filesToFindBySha1s = array_unique( array_values( $sha1s ) );
if ( $params['localonly'] ) {
$filesBySha1s = RepoGroup::singleton()->getLocalRepo()->findBySha1s( $filesToFindBySha1s );
* The prototype for a token function is func($pageid, $title)
* it should return a token or false (permission denied)
* @deprecated since 1.24
- * @return array Array(tokenname => function)
+ * @return array [ tokenname => function ]
*/
protected function getTokenFunctions() {
// Don't call the hooks twice
* The prototype for a token function is func($pageid, $title, $rc)
* it should return a token or false (permission denied)
* @deprecated since 1.24
- * @return array Array(tokenname => function)
+ * @return array [ tokenname => function ]
*/
protected function getTokenFunctions() {
// Don't call the hooks twice
$ret['description'] = $ext['description'];
}
if ( isset( $ext['descriptionmsg'] ) ) {
- // Can be a string or array( key, param1, param2, ... )
+ // Can be a string or [ key, param1, param2, ... ]
if ( is_array( $ext['descriptionmsg'] ) ) {
$ret['descriptionmsg'] = $ext['descriptionmsg'][0];
$ret['descriptionmsgparams'] = array_slice( $ext['descriptionmsg'], 1 );
* set to '*'. This may be skipped by including 'no*' in the value
* array.
* - Tags listed in META_BC_SUBELEMENTS will have their values changed to
- * array( '*' => $value ). This may be skipped by including 'nosub' in
+ * [ '*' => $value ]. This may be skipped by including 'nosub' in
* the value array.
* - If META_TYPE is 'BCarray', set it to 'default'
* - If META_TYPE is 'BCassoc', set it to 'default'
* as objects.
* - ArmorKVP: (string) If provided, transform arrays with META_TYPE 'kvp'
* and 'BCkvp' into arrays of two-element arrays, something like this:
- * $output = array();
+ * $output = [];
* foreach ( $input as $key => $value ) {
- * $pair = array();
+ * $pair = [];
* $pair[$META_KVP_KEY_NAME ?: $ArmorKVP_value] = $key;
* ApiResult::setContentValue( $pair, 'value', $value );
* $output[] = $pair;
* Add value to the output data at the given path.
*
* Path can be an indexed array, each element specifying the branch at which to add the new
- * value. Setting $path to array('a','b','c') is equivalent to data['a']['b']['c'] = $value.
+ * value. Setting $path to [ 'a', 'b', 'c' ] is equivalent to data['a']['b']['c'] = $value.
* If $path is null, the value will be inserted at the data root.
*
* @param array|string|int|null $path