From: Fomafix Date: Mon, 16 Jan 2017 15:42:53 +0000 (+0100) Subject: Use [...] instead of array(...) in PHP comments and documentation X-Git-Tag: 1.34.0-rc.0~1375^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=110a5877e9e6ebe7a6ecd758f5812f32fc4ef57e Use [...] instead of array(...) in PHP comments and documentation Change-Id: I0c83783051bf35fe785bc01644eeb2946902b6b2 --- diff --git a/docs/linkcache.txt b/docs/linkcache.txt index 13b6961356..cf28762ad5 100644 --- a/docs/linkcache.txt +++ b/docs/linkcache.txt @@ -13,8 +13,8 @@ purposes of updating the link tables. This application is now deprecated. To create a batch, you can use the following code: -$pages = array( 'Main Page', 'Project:Help', /* ... */ ); -$titles = array(); +$pages = [ 'Main Page', 'Project:Help', /* ... */ ]; +$titles = []; foreach( $pages as $page ){ $titles[] = Title::newFromText( $page ); diff --git a/docs/magicword.txt b/docs/magicword.txt index 6b4d37ee3e..42f701ca0b 100644 --- a/docs/magicword.txt +++ b/docs/magicword.txt @@ -28,16 +28,16 @@ Create a file called ExtensionName.i18n.magic.php with the following contents: ---- array( 1, 'CUSTOM' ), -); + 'mag_custom' => [ 1, 'CUSTOM' ], +]; -$magicWords['es'] = array( - 'mag_custom' => array( 1, 'ADUANERO' ), -); +$magicWords['es'] = [ + 'mag_custom' => [ 1, 'ADUANERO' ], +]; ---- $wgExtensionMessagesFiles['ExtensionNameMagic'] = __DIR__ . '/ExtensionName.i18n.magic.php'; @@ -62,16 +62,16 @@ Create a file called ExtensionName.i18n.magic.php with the following contents: ---- array( 0, 'custom' ), -); + 'mag_custom' => [ 0, 'custom' ], +]; -$magicWords['es'] = array( - 'mag_custom' => array( 0, 'aduanero' ), -); +$magicWords['es'] = [ + 'mag_custom' => [ 0, 'aduanero' ], +]; ---- $wgExtensionMessagesFiles['ExtensionNameMagic'] = __DIR__ . '/ExtensionName.i18n.magic.php'; diff --git a/docs/memcached.txt b/docs/memcached.txt index 1e68fb7cc3..ba325fe672 100644 --- a/docs/memcached.txt +++ b/docs/memcached.txt @@ -61,7 +61,7 @@ on port 11211, using up to 64MB of memory) In your LocalSettings.php file, set: $wgMainCacheType = CACHE_MEMCACHED; - $wgMemCachedServers = array( "127.0.0.1:11211" ); + $wgMemCachedServers = [ "127.0.0.1:11211" ]; The wiki should then use memcached to cache various data. To use multiple servers (physically separate boxes or multiple caches @@ -70,10 +70,10 @@ to the array. To increase the weight of a server (say, because it has twice the memory of the others and you want to spread usage evenly), make its entry a subarray: - $wgMemCachedServers = array( + $wgMemCachedServers = [ "127.0.0.1:11211", # one gig on this box - array("192.168.0.1:11211", 2 ) # two gigs on the other box - ); + [ "192.168.0.1:11211", 2 ] # two gigs on the other box + ]; == PHP client for memcached == diff --git a/docs/php-memcached/Documentation b/docs/php-memcached/Documentation index 6a0dce673a..ef9724b017 100644 --- a/docs/php-memcached/Documentation +++ b/docs/php-memcached/Documentation @@ -166,7 +166,7 @@ EXAMPLE: require 'MemCachedClient.inc.php'; // set the servers, with the last one having an integer weight value of 3 -$options["servers"] = array("10.0.0.15:11000","10.0.0.16:11001",array("10.0.0.17:11002", 3)); +$options["servers"] = ["10.0.0.15:11000","10.0.0.16:11001",["10.0.0.17:11002", 3]]; $options["debug"] = false; $memc = new MemCachedClient($options); @@ -175,7 +175,7 @@ $memc = new MemCachedClient($options); /*********************** * STORE AN ARRAY ***********************/ -$myarr = array("one","two", 3); +$myarr = ["one","two", 3]; $memc->set("key_one", $myarr); $val = $memc->get("key_one"); print $val[0]."\n"; // prints 'one' diff --git a/includes/Autopromote.php b/includes/Autopromote.php index 02c9d019d5..a4130371b8 100644 --- a/includes/Autopromote.php +++ b/includes/Autopromote.php @@ -89,12 +89,12 @@ class Autopromote { /** * Recursively check a condition. Conditions are in the form - * array( '&' or '|' or '^' or '!', cond1, cond2, ... ) + * [ '&' or '|' or '^' or '!', cond1, cond2, ... ] * where cond1, cond2, ... are themselves conditions; *OR* * APCOND_EMAILCONFIRMED, *OR* - * array( APCOND_EMAILCONFIRMED ), *OR* - * array( APCOND_EDITCOUNT, number of edits ), *OR* - * array( APCOND_AGE, seconds since registration ), *OR* + * [ APCOND_EMAILCONFIRMED ], *OR* + * [ APCOND_EDITCOUNT, number of edits ], *OR* + * [ APCOND_AGE, seconds since registration ], *OR* * similar constructs defined by extensions. * This function evaluates the former type recursively, and passes off to * self::checkCondition for evaluation of the latter type. diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 7d6318d206..2f793b5857 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -5427,20 +5427,20 @@ $wgAutoConfirmCount = 0; * * The basic syntax for `$wgAutopromote` is: * - * $wgAutopromote = array( + * $wgAutopromote = [ * 'groupname' => cond, * 'group2' => cond2, - * ); + * ]; * * A `cond` may be: * - a single condition without arguments: * Note that Autopromote wraps a single non-array value into an array * e.g. `APCOND_EMAILCONFIRMED` OR - * array( `APCOND_EMAILCONFIRMED` ) + * [ `APCOND_EMAILCONFIRMED` ] * - a single condition with arguments: - * e.g. `array( APCOND_EDITCOUNT, 100 )` + * e.g. `[ APCOND_EDITCOUNT, 100 ]` * - a set of conditions: - * e.g. `array( 'operand', cond1, cond2, ... )` + * e.g. `[ 'operand', cond1, cond2, ... ]` * * When constructing a set of conditions, the following conditions are available: * - `&` (**AND**): @@ -5451,25 +5451,25 @@ $wgAutoConfirmCount = 0; * promote if user matches **ONLY ONE OF THE CONDITIONS** * - `!` (**NOT**): * promote if user matces **NO** condition - * - array( APCOND_EMAILCONFIRMED ): + * - [ APCOND_EMAILCONFIRMED ]: * true if user has a confirmed e-mail - * - array( APCOND_EDITCOUNT, number of edits ): + * - [ APCOND_EDITCOUNT, number of edits ]: * true if user has the at least the number of edits as the passed parameter - * - array( APCOND_AGE, seconds since registration ): + * - [ APCOND_AGE, seconds since registration ]: * true if the length of time since the user created his/her account * is at least the same length of time as the passed parameter - * - array( APCOND_AGE_FROM_EDIT, seconds since first edit ): + * - [ APCOND_AGE_FROM_EDIT, seconds since first edit ]: * true if the length of time since the user made his/her first edit * is at least the same length of time as the passed parameter - * - array( APCOND_INGROUPS, group1, group2, ... ): + * - [ APCOND_INGROUPS, group1, group2, ... ]: * true if the user is a member of each of the passed groups - * - array( APCOND_ISIP, ip ): + * - [ APCOND_ISIP, ip ]: * true if the user has the passed IP address - * - array( APCOND_IPINRANGE, range ): + * - [ APCOND_IPINRANGE, range ]: * true if the user has an IP address in the range of the passed parameter - * - array( APCOND_BLOCKED ): + * - [ APCOND_BLOCKED ]: * true if the user is blocked - * - array( APCOND_ISBOT ): + * - [ APCOND_ISBOT ]: * true if the user is a bot * - similar constructs can be defined by extensions * @@ -6423,7 +6423,7 @@ $wgDeprecationReleaseLimit = false; * * @code * $wgProfiler['class'] = 'ProfilerXhprof'; - * $wgProfiler['output'] = array( 'ProfilerOutputDb' ); + * $wgProfiler['output'] = [ 'ProfilerOutputDb' ]; * $wgProfiler['sampling'] = 50; // one every 50 requests * @endcode * diff --git a/includes/Html.php b/includes/Html.php index aa51243d75..fdc348b852 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -518,7 +518,7 @@ class Html { $newValue = []; foreach ( $value as $k => $v ) { if ( is_string( $v ) ) { - // String values should be normal `array( 'foo' )` + // String values should be normal `[ 'foo' ]` // Just append them if ( !isset( $value[$v] ) ) { // As a special case don't set 'foo' if a diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 5833677b97..57cd74a490 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1723,7 +1723,7 @@ class OutputPage extends ContextSource { /** * Get the files used on this page * - * @return array (dbKey => array('time' => MW timestamp or null, 'sha1' => sha1 or '')) + * @return array [ dbKey => [ 'time' => MW timestamp or null, 'sha1' => sha1 or '' ] ] * @since 1.18 */ public function getFileSearchOptions() { diff --git a/includes/PathRouter.php b/includes/PathRouter.php index eb52d7cd23..2882e6632e 100644 --- a/includes/PathRouter.php +++ b/includes/PathRouter.php @@ -53,8 +53,8 @@ * - In a pattern $1, $2, etc... will be replaced with the relevant contents * - If you used a keyed array as a path pattern, $key will be replaced with * the relevant contents - * - The default behavior is equivalent to `array( 'title' => '$1' )`, - * if you don't want the title parameter you can explicitly use `array( 'title' => false )` + * - The default behavior is equivalent to `[ 'title' => '$1' ]`, + * if you don't want the title parameter you can explicitly use `[ 'title' => false ]` * - You can specify a value that won't have replacements in it * using `'foo' => [ 'value' => 'bar' ];` * @@ -80,7 +80,7 @@ class PathRouter { /** * Protected helper to do the actual bulk work of adding a single pattern. * This is in a separate method so that add() can handle the difference between - * a single string $path and an array() $path that contains multiple path + * a single string $path and an array $path that contains multiple path * patterns each with an associated $key to pass on. * @param string $path * @param array $params @@ -247,9 +247,9 @@ class PathRouter { } // We know the difference between null (no matches) and - // array() (a match with no data) but our WebRequest caller - // expects array() even when we have no matches so return - // a array() when we have null + // [] (a match with no data) but our WebRequest caller + // expects [] even when we have no matches so return + // a [] when we have null return $matches ?? []; } diff --git a/includes/Title.php b/includes/Title.php index b7b28afaf7..cf81b98e22 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1979,7 +1979,7 @@ class Title implements LinkTarget, IDBAccessObject { * * @param string|string[] $query An optional query string, * not used for interwiki links. Can be specified as an associative array as well, - * e.g., array( 'action' => 'edit' ) (keys and values will be URL-escaped). + * e.g., [ 'action' => 'edit' ] (keys and values will be URL-escaped). * Some query patterns will trigger various shorturl path replacements. * @param string|string[]|bool $query2 An optional secondary query array. This one MUST * be an array. If a string is passed it will be interpreted as a deprecated diff --git a/includes/TrackingCategories.php b/includes/TrackingCategories.php index ebdbc421d8..d9e185ef1f 100644 --- a/includes/TrackingCategories.php +++ b/includes/TrackingCategories.php @@ -60,7 +60,7 @@ class TrackingCategories { /** * Read the global and extract title objects from the corresponding messages - * @return array Array( 'msg' => Title, 'cats' => Title[] ) + * @return array [ 'msg' => Title, 'cats' => Title[] ] */ public function getTrackingCategories() { $categories = array_merge( diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 76d94b2e19..6593e49d8a 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -1140,7 +1140,7 @@ HTML; /** * Parse the Accept-Language header sent by the client into an array * - * @return array Array( languageCode => q-value ) sorted by q-value in + * @return array [ languageCode => q-value ] sorted by q-value in * descending order then appearing time in the header in ascending order. * May contain the "language" '*', which applies to languages other than those explicitly listed. * This is aligned with rfc2616 section 14.4 diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index 47ff0fb921..59ec4f61ca 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -252,7 +252,7 @@ abstract class ApiQueryBase extends ApiBase { } /** - * Equivalent to addWhere(array($field => $value)) + * Equivalent to addWhere( [ $field => $value ] ) * @param string $field Field name * @param string|string[] $value Value; ignored if null or empty array */ diff --git a/includes/changetags/ChangeTags.php b/includes/changetags/ChangeTags.php index 7466f8236a..cf6ed17dd4 100644 --- a/includes/changetags/ChangeTags.php +++ b/includes/changetags/ChangeTags.php @@ -603,8 +603,8 @@ class ChangeTags { * ChangeTags::updateTags() instead, unless directly handling a user request * to add or remove tags from an existing revision or log entry. * - * @param array|null $tagsToAdd If none, pass array() or null - * @param array|null $tagsToRemove If none, pass array() or null + * @param array|null $tagsToAdd If none, pass [] or null + * @param array|null $tagsToRemove If none, pass [] or null * @param int|null $rc_id The rc_id of the change to add the tags to * @param int|null $rev_id The rev_id of the change to add the tags to * @param int|null $log_id The log_id of the change to add the tags to diff --git a/includes/deferred/LinksUpdate.php b/includes/deferred/LinksUpdate.php index 9adb2b07b1..266d7687d0 100644 --- a/includes/deferred/LinksUpdate.php +++ b/includes/deferred/LinksUpdate.php @@ -965,7 +965,7 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate { /** * Get an array of existing inline interwiki links, as a 2-D array - * @return array (prefix => array(dbkey => 1)) + * @return array [ prefix => [ dbkey => 1 ] ] */ private function getExistingInterwikis() { $res = $this->getDB()->select( 'iwlinks', [ 'iwl_prefix', 'iwl_title' ], diff --git a/includes/htmlform/HTMLFormField.php b/includes/htmlform/HTMLFormField.php index 16dc46591b..ff805d84fa 100644 --- a/includes/htmlform/HTMLFormField.php +++ b/includes/htmlform/HTMLFormField.php @@ -866,7 +866,7 @@ abstract class HTMLFormField { * that return value has no taint. * * @param string $value The value of the input - * @return array array( $errors, $errorClass ) + * @return array [ $errors, $errorClass ] * @return-taint none */ public function getErrorsAndErrorClass( $value ) { diff --git a/includes/jobqueue/JobSpecification.php b/includes/jobqueue/JobSpecification.php index 80a46d04ba..19ff9677ea 100644 --- a/includes/jobqueue/JobSpecification.php +++ b/includes/jobqueue/JobSpecification.php @@ -27,8 +27,8 @@ * @code * $job = new JobSpecification( * 'null', - * array( 'lives' => 1, 'usleep' => 100, 'pi' => 3.141569 ), - * array( 'removeDuplicates' => 1 ) + * [ 'lives' => 1, 'usleep' => 100, 'pi' => 3.141569 ], + * [ 'removeDuplicates' => 1 ] * ); * JobQueueGroup::singleton()->push( $job ) * @endcode diff --git a/includes/page/PageArchive.php b/includes/page/PageArchive.php index cdaf06268b..d69a433d9c 100644 --- a/includes/page/PageArchive.php +++ b/includes/page/PageArchive.php @@ -406,8 +406,8 @@ class PageArchive { * @param User|null $user User performing the action, or null to use $wgUser * @param string|string[]|null $tags Change tags to add to log entry * ($user should be able to add the specified tags before this is called) - * @return array|bool array(number of file revisions restored, number of image revisions - * restored, log message) on success, false on failure. + * @return array|bool [ number of file revisions restored, number of image revisions + * restored, log message ] on success, false on failure. */ public function undelete( $timestamps, $comment = '', $fileVersions = [], $unsuppress = false, User $user = null, $tags = null diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index e29e2b108d..d65d87b66a 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -3077,7 +3077,7 @@ class WikiPage implements Page, IDBAccessObject { * (with ChangeTags::canAddTagsAccompanyingChange) * * @return array Array of errors, each error formatted as - * array(messagekey, param1, param2, ...). + * [ messagekey, param1, param2, ... ]. * On success, the array is empty. This array can also be passed to * OutputPage::showPermissionsErrorPage(). */ diff --git a/includes/parser/Sanitizer.php b/includes/parser/Sanitizer.php index f76e3a9c5d..d8e5e3e321 100644 --- a/includes/parser/Sanitizer.php +++ b/includes/parser/Sanitizer.php @@ -1245,7 +1245,7 @@ class Sanitizer { * HTML5 definition of id attribute * * @param string $id Id to escape - * @param string|array $options String or array of strings (default is array()): + * @param string|array $options String or array of strings (default is []): * 'noninitial': This is a non-initial fragment of an id, not a full id, * so don't pay attention if the first character isn't valid at the * beginning of an id. @@ -1948,7 +1948,7 @@ class Sanitizer { # rbc 'rb' => $common, 'rp' => $common, - 'rt' => $common, # array_merge( $common, array( 'rbspan' ) ), + 'rt' => $common, # array_merge( $common, [ 'rbspan' ] ), 'rtc' => $common, # MathML root element, where used for extensions diff --git a/includes/rcfeed/RedisPubSubFeedEngine.php b/includes/rcfeed/RedisPubSubFeedEngine.php index c954df1a5b..66b1529986 100644 --- a/includes/rcfeed/RedisPubSubFeedEngine.php +++ b/includes/rcfeed/RedisPubSubFeedEngine.php @@ -29,10 +29,10 @@ * * @par Example: * @code - * $wgRCFeeds['redis'] = array( + * $wgRCFeeds['redis'] = [ * 'formatter' => 'JSONRCFeedFormatter', * 'uri' => "redis://127.0.0.1:6379/rc.$wgDBname", - * ); + * ]; * @endcode * * @since 1.22 diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index 87a45155b1..47c8987a00 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -334,7 +334,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { * to $IP * @param string|null $remoteBasePath Path to use if not provided in module definition. Defaults * to $wgResourceBasePath - * @return array Array( localBasePath, remoteBasePath ) + * @return array [ localBasePath, remoteBasePath ] */ public static function extractBasePaths( $options = [], diff --git a/includes/specialpage/SpecialPage.php b/includes/specialpage/SpecialPage.php index eba406e7de..d7e39d5129 100644 --- a/includes/specialpage/SpecialPage.php +++ b/includes/specialpage/SpecialPage.php @@ -456,10 +456,10 @@ class SpecialPage implements MessageLocalizer { * For example, if a page supports subpages "foo", "bar" and "baz" (as in Special:PageName/foo, * etc.): * - * - `prefixSearchSubpages( "ba" )` should return `array( "bar", "baz" )` - * - `prefixSearchSubpages( "f" )` should return `array( "foo" )` - * - `prefixSearchSubpages( "z" )` should return `array()` - * - `prefixSearchSubpages( "" )` should return `array( foo", "bar", "baz" )` + * - `prefixSearchSubpages( "ba" )` should return `[ "bar", "baz" ]` + * - `prefixSearchSubpages( "f" )` should return `[ "foo" ]` + * - `prefixSearchSubpages( "z" )` should return `[]` + * - `prefixSearchSubpages( "" )` should return `[ foo", "bar", "baz" ]` * * @param string $search Prefix to search for * @param int $limit Maximum number of results to return (usually 10) diff --git a/includes/specialpage/SpecialPageFactory.php b/includes/specialpage/SpecialPageFactory.php index 1053bda5c4..9a793c3146 100644 --- a/includes/specialpage/SpecialPageFactory.php +++ b/includes/specialpage/SpecialPageFactory.php @@ -361,7 +361,7 @@ class SpecialPageFactory { * subpage. * * @param string $alias - * @return array Array( String, String|null ), or array( null, null ) if the page is invalid + * @return array [ String, String|null ], or [ null, null ] if the page is invalid */ public function resolveAlias( $alias ) { $bits = explode( '/', $alias, 2 ); diff --git a/includes/specials/SpecialUnblock.php b/includes/specials/SpecialUnblock.php index bedd2c58e5..c7e2a3733f 100644 --- a/includes/specials/SpecialUnblock.php +++ b/includes/specials/SpecialUnblock.php @@ -162,7 +162,7 @@ class SpecialUnblock extends SpecialPage { * Submit callback for an HTMLForm object * @param array $data * @param HTMLForm $form - * @return array|bool Array(message key, parameters) + * @return array|bool [ message key, parameters ] */ public static function processUIUnblock( array $data, HTMLForm $form ) { return self::processUnblock( $data, $form->getContext() ); @@ -177,7 +177,7 @@ class SpecialUnblock extends SpecialPage { * @param array $data * @param IContextSource $context * @throws ErrorPageError - * @return array|bool Array( Array( message key, parameters ) ) on failure, True on success + * @return array|bool [ [ message key, parameters ] ] on failure, True on success */ public static function processUnblock( array $data, IContextSource $context ) { $performer = $context->getUser(); diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index 87bc259c47..fc54890563 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -1001,12 +1001,12 @@ class UserrightsPage extends SpecialPage { /** * Returns $this->getUser()->changeableGroups() * - * @return array Array( - * 'add' => array( addablegroups ), - * 'remove' => array( removablegroups ), - * 'add-self' => array( addablegroups to self ), - * 'remove-self' => array( removable groups from self ) - * ) + * @return array [ + * 'add' => [ addablegroups ], + * 'remove' => [ removablegroups ], + * 'add-self' => [ addablegroups to self ], + * 'remove-self' => [ removable groups from self ] + * ] */ function changeableGroups() { return $this->getUser()->changeableGroups(); diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 0c4959a48e..5456ce7861 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -812,7 +812,7 @@ class SpecialVersion extends SpecialPage { } // ... and generate the description; which can be a parameterized l10n message - // in the form array( , , ... ) or just a straight + // in the form [ , , ... ] or just a straight // up string if ( isset( $extension['descriptionmsg'] ) ) { // Localized description of extension diff --git a/includes/user/User.php b/includes/user/User.php index 2de90edb4b..3a57c0b3eb 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -3297,7 +3297,7 @@ class User implements IDBAccessObject, UserIdentity { * and 'all', which forces a reset of *all* preferences and overrides everything else. * * @param array|string $resetKinds Which kinds of preferences to reset. Defaults to - * array( 'registered', 'registered-multiselect', 'registered-checkmatrix', 'unused' ) + * [ 'registered', 'registered-multiselect', 'registered-checkmatrix', 'unused' ] * for backwards-compatibility. * @param IContextSource|null $context Context source used when $resetKinds * does not contain 'all', passed to getOptionKinds(). @@ -5044,10 +5044,10 @@ class User implements IDBAccessObject, UserIdentity { * Returns an array of the groups that a particular group can add/remove. * * @param string $group The group to check for whether it can add/remove - * @return array Array( 'add' => array( addablegroups ), - * 'remove' => array( removablegroups ), - * 'add-self' => array( addablegroups to self), - * 'remove-self' => array( removable groups from self) ) + * @return array [ 'add' => [ addablegroups ], + * 'remove' => [ removablegroups ], + * 'add-self' => [ addablegroups to self ], + * 'remove-self' => [ removable groups from self ] ] */ public static function changeableByGroup( $group ) { global $wgAddGroups, $wgRemoveGroups, $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf; @@ -5117,10 +5117,10 @@ class User implements IDBAccessObject, UserIdentity { /** * Returns an array of groups that this user can add and remove - * @return array Array( 'add' => array( addablegroups ), - * 'remove' => array( removablegroups ), - * 'add-self' => array( addablegroups to self), - * 'remove-self' => array( removable groups from self) ) + * @return array [ 'add' => [ addablegroups ], + * 'remove' => [ removablegroups ], + * 'add-self' => [ addablegroups to self ], + * 'remove-self' => [ removable groups from self ] ] */ public function changeableGroups() { if ( $this->isAllowed( 'userrights' ) ) { diff --git a/languages/Language.php b/languages/Language.php index 9d7ce09125..fd8aedff2b 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -4537,7 +4537,7 @@ class Language { * * @since 1.22 * @param string $code Language code - * @return array Array( fallbacks, site fallbacks ) + * @return array [ fallbacks, site fallbacks ] */ public static function getFallbacksIncludingSiteLanguage( $code ) { global $wgLanguageCode; diff --git a/tests/phpunit/includes/GlobalFunctions/wfUrlencodeTest.php b/tests/phpunit/includes/GlobalFunctions/wfUrlencodeTest.php index 5d9f63daa7..f9735c1ab1 100644 --- a/tests/phpunit/includes/GlobalFunctions/wfUrlencodeTest.php +++ b/tests/phpunit/includes/GlobalFunctions/wfUrlencodeTest.php @@ -69,7 +69,7 @@ class WfUrlencodeTest extends MediaWikiTestCase { } } else { throw new MWException( __METHOD__ . " given invalid expectation for " - . "'$server'. Should be a string or an array( => ).\n" ); + . "'$server'. Should be a string or an array [ => ].\n" ); } } diff --git a/tests/phpunit/includes/HtmlTest.php b/tests/phpunit/includes/HtmlTest.php index 999e0bb56c..388b914ddd 100644 --- a/tests/phpunit/includes/HtmlTest.php +++ b/tests/phpunit/includes/HtmlTest.php @@ -316,7 +316,7 @@ class HtmlTest extends MediaWikiTestCase { /** * How do we handle duplicate keys in HTML attributes expansion? - * We could pass a "class" the values: 'GREEN' and array( 'GREEN' => false ) + * We could pass a "class" the values: 'GREEN' and [ 'GREEN' => false ] * The latter will take precedence. * * Feature added by r96188 diff --git a/tests/phpunit/includes/StatusTest.php b/tests/phpunit/includes/StatusTest.php index 6e62afdd4d..37ebf4cfcb 100644 --- a/tests/phpunit/includes/StatusTest.php +++ b/tests/phpunit/includes/StatusTest.php @@ -237,7 +237,7 @@ class StatusTest extends MediaWikiLangTestCase { } /** - * @param array $messageDetails E.g. array( 'KEY' => array(/PARAMS/) ) + * @param array $messageDetails E.g. [ 'KEY' => [ /PARAMS/ ] ] * @return Message[] */ protected function getMockMessages( $messageDetails ) { diff --git a/tests/phpunit/includes/TestLogger.php b/tests/phpunit/includes/TestLogger.php index e50e1bcfd0..fd45732422 100644 --- a/tests/phpunit/includes/TestLogger.php +++ b/tests/phpunit/includes/TestLogger.php @@ -73,8 +73,8 @@ class TestLogger extends \Psr\Log\AbstractLogger { /** * Return the collected logs - * @return array Array of array( string $level, string $message ), or - * array( string $level, string $message, array $context ) if $collectContext was true. + * @return array Array of [ string $level, string $message ], or + * [ string $level, string $message, array $context ] if $collectContext was true. */ public function getBuffer() { return $this->buffer; diff --git a/tests/phpunit/includes/TitleTest.php b/tests/phpunit/includes/TitleTest.php index d6c34014f7..529d9fb0dd 100644 --- a/tests/phpunit/includes/TitleTest.php +++ b/tests/phpunit/includes/TitleTest.php @@ -338,7 +338,7 @@ class TitleTest extends MediaWikiTestCase { public function testWgWhitelistReadRegexp( $whitelistRegexp, $source, $action, $expected ) { // $wgWhitelistReadRegexp must be an array. Since the provided test cases // usually have only one regex, it is more concise to write the lonely regex - // as a string. Thus we cast to an array() to honor $wgWhitelistReadRegexp + // as a string. Thus we cast to a [] to honor $wgWhitelistReadRegexp // type requisite. if ( is_string( $whitelistRegexp ) ) { $whitelistRegexp = [ $whitelistRegexp ]; diff --git a/tests/phpunit/includes/api/query/ApiQueryTestBase.php b/tests/phpunit/includes/api/query/ApiQueryTestBase.php index 7869bbd2db..71a77b62ab 100644 --- a/tests/phpunit/includes/api/query/ApiQueryTestBase.php +++ b/tests/phpunit/includes/api/query/ApiQueryTestBase.php @@ -86,7 +86,7 @@ STR; /** * Checks that the request's result matches the expected results. * Assumes no rawcontinue and a complete batch. - * @param array $values Array is a two element array( request, expected_results ) + * @param array $values Array is a two element [ request, expected_results ] * @param array|null $session * @param bool $appendModule * @param User|null $user diff --git a/tests/phpunit/includes/libs/IPTest.php b/tests/phpunit/includes/libs/IPTest.php index 9ec53c00c7..9f2fb1c5d7 100644 --- a/tests/phpunit/includes/libs/IPTest.php +++ b/tests/phpunit/includes/libs/IPTest.php @@ -481,7 +481,7 @@ class IPTest extends PHPUnit\Framework\TestCase { $this->assertFalseCIDR( '192.0.2.0/33', "mask > 32" ); // Check internal logic - # 0 mask always result in array(0,0) + # 0 mask always result in [ 0, 0 ] $this->assertEquals( [ 0, 0 ], IP::parseCIDR( '192.0.0.2/0' ) ); $this->assertEquals( [ 0, 0 ], IP::parseCIDR( '0.0.0.0/0' ) ); $this->assertEquals( [ 0, 0 ], IP::parseCIDR( '255.255.255.255/0' ) ); diff --git a/tests/phpunit/includes/specials/SpecialSearchTest.php b/tests/phpunit/includes/specials/SpecialSearchTest.php index 4f4fa259a0..4dd6c8045e 100644 --- a/tests/phpunit/includes/specials/SpecialSearchTest.php +++ b/tests/phpunit/includes/specials/SpecialSearchTest.php @@ -15,9 +15,9 @@ class SpecialSearchTest extends MediaWikiTestCase { * @covers SpecialSearch::load * @dataProvider provideSearchOptionsTests * @param array $requested Request parameters. For example: - * array( 'ns5' => true, 'ns6' => true). Null to use default options. + * [ 'ns5' => true, 'ns6' => true ]. Null to use default options. * @param array $userOptions User options to test with. For example: - * array('searchNs5' => 1 );. Null to use default options. + * [ 'searchNs5' => 1 ];. Null to use default options. * @param string $expectedProfile An expected search profile name * @param array $expectedNS Expected namespaces * @param string $message diff --git a/tests/phpunit/includes/utils/BatchRowUpdateTest.php b/tests/phpunit/includes/utils/BatchRowUpdateTest.php index 52b143393f..dd21addaee 100644 --- a/tests/phpunit/includes/utils/BatchRowUpdateTest.php +++ b/tests/phpunit/includes/utils/BatchRowUpdateTest.php @@ -49,7 +49,7 @@ class BatchRowUpdateTest extends MediaWikiTestCase { $this->assertEquals( $response[$pos], $rows, "Testing row in position $pos" ); $pos++; } - // -1 is because the final array() marks the end and isnt included + // -1 is because the final [] marks the end and isn't included $this->assertEquals( count( $response ) - 1, $pos ); } diff --git a/tests/phpunit/includes/utils/UIDGeneratorTest.php b/tests/phpunit/includes/utils/UIDGeneratorTest.php index 6b81a66fea..e600021e97 100644 --- a/tests/phpunit/includes/utils/UIDGeneratorTest.php +++ b/tests/phpunit/includes/utils/UIDGeneratorTest.php @@ -67,7 +67,7 @@ class UIDGeneratorTest extends PHPUnit\Framework\TestCase { } /** - * array( method, length, bits, hostbits ) + * [ method, length, bits, hostbits ] * NOTE: When adding a new method name here please update the covers tags for the tests! */ public static function provider_testTimestampedUID() {