From 6b221fa96a25828d47d8edbdcd85a9b736d003f6 Mon Sep 17 00:00:00 2001 From: Amir Sarabadani Date: Fri, 26 Aug 2016 16:06:58 +0430 Subject: [PATCH] Clean up array() syntax in docs, part IV Change-Id: If626409a93d31bf90c054c9bf7ba44a78ea9a621 --- includes/Message.php | 4 +- includes/debug/logger/MonologSpi.php | 92 +++++++++---------- includes/installer/Installer.php | 8 +- includes/installer/LocalSettingsGenerator.php | 2 +- includes/parser/Parser.php | 6 +- .../resourceloader/ResourceLoaderModule.php | 8 +- includes/upload/UploadBase.php | 2 +- 7 files changed, 61 insertions(+), 61 deletions(-) diff --git a/includes/Message.php b/includes/Message.php index 2c979dedd0..c2c954ab62 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -120,7 +120,7 @@ * * @code * // old style: - * wfMsgExt( 'key', array( 'parseinline' ), 'apple' ); + * wfMsgExt( 'key', [ 'parseinline' ], 'apple' ); * // new style: * wfMessage( 'key', 'apple' )->parse(); * @endcode @@ -131,7 +131,7 @@ * Places where HTML cannot be used. {{-transformation is done. * @code * // old style: - * wfMsgExt( 'key', array( 'parsemag' ), 'apple', 'pear' ); + * wfMsgExt( 'key', [ 'parsemag' ], 'apple', 'pear' ); * // new style: * wfMessage( 'key', 'apple', 'pear' )->text(); * @endcode diff --git a/includes/debug/logger/MonologSpi.php b/includes/debug/logger/MonologSpi.php index 49ad9e6725..f44ff1ceef 100644 --- a/includes/debug/logger/MonologSpi.php +++ b/includes/debug/logger/MonologSpi.php @@ -39,73 +39,73 @@ use ObjectFactory; * global configuration variable used by LoggerFactory to construct its * default SPI provider: * @code - * $wgMWLoggerDefaultSpi = array( + * $wgMWLoggerDefaultSpi = [ * 'class' => '\\MediaWiki\\Logger\\MonologSpi', - * 'args' => array( array( - * 'loggers' => array( - * '@default' => array( - * 'processors' => array( 'wiki', 'psr', 'pid', 'uid', 'web' ), - * 'handlers' => array( 'stream' ), - * ), - * 'runJobs' => array( - * 'processors' => array( 'wiki', 'psr', 'pid' ), - * 'handlers' => array( 'stream' ), - * ) - * ), - * 'processors' => array( - * 'wiki' => array( + * 'args' => [ [ + * 'loggers' => [ + * '@default' => [ + * 'processors' => [ 'wiki', 'psr', 'pid', 'uid', 'web' ], + * 'handlers' => [ 'stream' ], + * ], + * 'runJobs' => [ + * 'processors' => [ 'wiki', 'psr', 'pid' ], + * 'handlers' => [ 'stream' ], + * ] + * ], + * 'processors' => [ + * 'wiki' => [ * 'class' => '\\MediaWiki\\Logger\\Monolog\\WikiProcessor', - * ), - * 'psr' => array( + * ], + * 'psr' => [ * 'class' => '\\Monolog\\Processor\\PsrLogMessageProcessor', - * ), - * 'pid' => array( + * ], + * 'pid' => [ * 'class' => '\\Monolog\\Processor\\ProcessIdProcessor', - * ), - * 'uid' => array( + * ], + * 'uid' => [ * 'class' => '\\Monolog\\Processor\\UidProcessor', - * ), - * 'web' => array( + * ], + * 'web' => [ * 'class' => '\\Monolog\\Processor\\WebProcessor', - * ), - * ), - * 'handlers' => array( - * 'stream' => array( + * ], + * ], + * 'handlers' => [ + * 'stream' => [ * 'class' => '\\Monolog\\Handler\\StreamHandler', - * 'args' => array( 'path/to/your.log' ), + * 'args' => [ 'path/to/your.log' ], * 'formatter' => 'line', - * ), - * 'redis' => array( + * ], + * 'redis' => [ * 'class' => '\\Monolog\\Handler\\RedisHandler', - * 'args' => array( function() { + * 'args' => [ function() { * $redis = new Redis(); * $redis->connect( '127.0.0.1', 6379 ); * return $redis; * }, * 'logstash' - * ), + * ], * 'formatter' => 'logstash', * 'buffer' => true, - * ), - * 'udp2log' => array( + * ], + * 'udp2log' => [ * 'class' => '\\MediaWiki\\Logger\\Monolog\\LegacyHandler', - * 'args' => array( + * 'args' => [ * 'udp://127.0.0.1:8420/mediawiki - * ), + * ], * 'formatter' => 'line', - * ), - * ), - * 'formatters' => array( - * 'line' => array( + * ], + * ], + * 'formatters' => [ + * 'line' => [ * 'class' => '\\Monolog\\Formatter\\LineFormatter', - * ), - * 'logstash' => array( + * ], + * 'logstash' => [ * 'class' => '\\Monolog\\Formatter\\LogstashFormatter', - * 'args' => array( 'mediawiki', php_uname( 'n' ), null, '', 1 ), - * ), - * ), - * ) ), - * ); + * 'args' => [ 'mediawiki', php_uname( 'n' ), null, '', 1 ], + * ], + * ], + * ] ], + * ]; * @endcode * * @see https://github.com/Seldaek/monolog diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index d508d7689d..eafb9d4939 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -1437,10 +1437,10 @@ abstract class Installer { /** * Get an array of install steps. Should always be in the format of - * array( + * [ * 'name' => 'someuniquename', - * 'callback' => array( $obj, 'method' ), - * ) + * 'callback' => [ $obj, 'method' ], + * ] * There must be a config-install-$name message defined per step, which will * be shown on install. * @@ -1724,7 +1724,7 @@ abstract class Installer { * Add an installation step following the given step. * * @param callable $callback A valid installation callback array, in this form: - * array( 'name' => 'some-unique-name', 'callback' => array( $obj, 'function' ) ); + * [ 'name' => 'some-unique-name', 'callback' => [ $obj, 'function' ] ]; * @param string $findStep The step to find. Omit to put the step at the beginning */ public function addInstallStep( $callback, $findStep = 'BEGINNING' ) { diff --git a/includes/installer/LocalSettingsGenerator.php b/includes/installer/LocalSettingsGenerator.php index 1d7c7f22fc..a9e3e8584b 100644 --- a/includes/installer/LocalSettingsGenerator.php +++ b/includes/installer/LocalSettingsGenerator.php @@ -98,7 +98,7 @@ class LocalSettingsGenerator { * For $wgGroupPermissions, set a given ['group']['permission'] value. * @param string $group Group name * @param array $rightsArr An array of permissions, in the form of: - * array( 'right' => true, 'right2' => false ) + * [ 'right' => true, 'right2' => false ] */ public function setGroupRights( $group, $rightsArr ) { $this->groupPermissions[$group] = $rightsArr; diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index b116bd4451..035baacf0e 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -906,11 +906,11 @@ class Parser { * the form: * * @code - * 'UNIQ-xxxxx' => array( + * 'UNIQ-xxxxx' => [ * 'element', * 'tag content', - * array( 'param' => 'x' ), - * 'tag content' ) ) + * [ 'param' => 'x' ], + * 'tag content' ] * @endcode * * @param array $elements List of element names. Comments are always extracted. diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index 48e7937104..de89fc7417 100644 --- a/includes/resourceloader/ResourceLoaderModule.php +++ b/includes/resourceloader/ResourceLoaderModule.php @@ -264,8 +264,8 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { * * @param ResourceLoaderContext $context * @return array List of CSS strings or array of CSS strings keyed by media type. - * like array( 'screen' => '.foo { width: 0 }' ); - * or array( 'screen' => array( '.foo { width: 0 }' ) ); + * like [ 'screen' => '.foo { width: 0 }' ]; + * or [ 'screen' => [ '.foo { width: 0 }' ] ]; */ public function getStyles( ResourceLoaderContext $context ) { // Stub, override expected @@ -279,7 +279,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { * load the files directly. See also getScriptURLsForDebug() * * @param ResourceLoaderContext $context - * @return array Array( mediaType => array( URL1, URL2, ... ), ... ) + * @return array [ mediaType => [ URL1, URL2, ... ], ... ] */ public function getStyleURLsForDebug( ResourceLoaderContext $context ) { $resourceLoader = $context->getResourceLoader(); @@ -637,7 +637,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { // Styles if ( $context->shouldIncludeStyles() ) { $styles = []; - // Don't create empty stylesheets like array( '' => '' ) for modules + // Don't create empty stylesheets like [ '' => '' ] for modules // that don't *have* any stylesheets (bug 38024). $stylePairs = $this->getStyles( $context ); if ( count( $stylePairs ) ) { diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index e2f7763251..b37c83104e 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -1659,7 +1659,7 @@ abstract class UploadBase { * @return array Containing the namespace URI and prefix */ private static function splitXmlNamespace( $element ) { - // 'http://www.w3.org/2000/svg:script' -> array( 'http://www.w3.org/2000/svg', 'script' ) + // 'http://www.w3.org/2000/svg:script' -> [ 'http://www.w3.org/2000/svg', 'script' ] $parts = explode( ':', strtolower( $element ) ); $name = array_pop( $parts ); $ns = implode( ':', $parts ); -- 2.20.1