Convert all array() syntax to []
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoaderModule.php
index 14132d6..8da1e21 100644 (file)
@@ -60,16 +60,16 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
        /* Protected Members */
 
        protected $name = null;
-       protected $targets = array( 'desktop' );
+       protected $targets = [ 'desktop' ];
 
        // In-object cache for file dependencies
-       protected $fileDeps = array();
+       protected $fileDeps = [];
        // In-object cache for message blob (keyed by language)
-       protected $msgBlobs = array();
+       protected $msgBlobs = [];
        // In-object cache for version hash
-       protected $versionHash = array();
+       protected $versionHash = [];
        // In-object cache for module content
-       protected $contents = array();
+       protected $contents = [];
 
        /**
         * @var Config
@@ -153,7 +153,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
         */
        public function getTemplates() {
                // Stub, override expected.
-               return array();
+               return [];
        }
 
        /**
@@ -214,7 +214,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
        public function getScriptURLsForDebug( ResourceLoaderContext $context ) {
                $resourceLoader = $context->getResourceLoader();
                $derivative = new DerivativeResourceLoaderContext( $context );
-               $derivative->setModules( array( $this->getName() ) );
+               $derivative->setModules( [ $this->getName() ] );
                $derivative->setOnly( 'scripts' );
                $derivative->setDebug( true );
 
@@ -223,7 +223,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
                        $derivative
                );
 
-               return array( $url );
+               return [ $url ];
        }
 
        /**
@@ -246,7 +246,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
         */
        public function getStyles( ResourceLoaderContext $context ) {
                // Stub, override expected
-               return array();
+               return [];
        }
 
        /**
@@ -261,7 +261,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
        public function getStyleURLsForDebug( ResourceLoaderContext $context ) {
                $resourceLoader = $context->getResourceLoader();
                $derivative = new DerivativeResourceLoaderContext( $context );
-               $derivative->setModules( array( $this->getName() ) );
+               $derivative->setModules( [ $this->getName() ] );
                $derivative->setOnly( 'styles' );
                $derivative->setDebug( true );
 
@@ -270,7 +270,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
                        $derivative
                );
 
-               return array( 'all' => array( $url ) );
+               return [ 'all' => [ $url ] ];
        }
 
        /**
@@ -282,7 +282,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
         */
        public function getMessages() {
                // Stub, override expected
-               return array();
+               return [];
        }
 
        /**
@@ -341,7 +341,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
         */
        public function getDependencies( ResourceLoaderContext $context = null ) {
                // Stub, override expected
-               return array();
+               return [];
        }
 
        /**
@@ -387,10 +387,10 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
                        $dbr = wfGetDB( DB_SLAVE );
                        $deps = $dbr->selectField( 'module_deps',
                                'md_deps',
-                               array(
+                               [
                                        'md_module' => $this->getName(),
                                        'md_skin' => $vary,
-                               ),
+                               ],
                                __METHOD__
                        );
 
@@ -399,7 +399,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
                                        (array)FormatJson::decode( $deps, true )
                                );
                        } else {
-                               $this->fileDeps[$vary] = array();
+                               $this->fileDeps[$vary] = [];
                        }
                }
                return $this->fileDeps[$vary];
@@ -444,13 +444,13 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
                                $vary = $context->getSkin() . '|' . $context->getLanguage();
                                $dbw = wfGetDB( DB_MASTER );
                                $dbw->replace( 'module_deps',
-                                       array( array( 'md_module', 'md_skin' ) ),
-                                       array(
+                                       [ [ 'md_module', 'md_skin' ] ],
+                                       [
                                                'md_module' => $this->getName(),
                                                'md_skin' => $vary,
                                                // Use relative paths to avoid ghost entries when $IP changes (T111481)
                                                'md_deps' => FormatJson::encode( self::getRelativePaths( $localFileRefs ) ),
-                                       )
+                                       ]
                                );
 
                                $dbw->onTransactionIdle( function () use ( &$scopeLock ) {
@@ -508,9 +508,9 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
                // Message blobs may only vary language, not by context keys
                $lang = $context->getLanguage();
                if ( !isset( $this->msgBlobs[$lang] ) ) {
-                       $this->getLogger()->warning( 'Message blob for {module} should have been preloaded', array(
+                       $this->getLogger()->warning( 'Message blob for {module} should have been preloaded', [
                                'module' => $this->getName(),
-                       ) );
+                       ] );
                        $store = $context->getResourceLoader()->getMessageBlobStore();
                        $this->msgBlobs[$lang] = $store->getBlob( $this, $lang );
                }
@@ -538,7 +538,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
         * @return array Module-specific LESS variables.
         */
        protected function getLessVars( ResourceLoaderContext $context ) {
-               return array();
+               return [];
        }
 
        /**
@@ -574,7 +574,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
                // and that are non-empty (e.g. don't include "templates" for modules without
                // templates). This helps prevent invalidating cache for all modules when new
                // optional properties are introduced.
-               $content = array();
+               $content = [];
 
                // Scripts
                if ( $context->shouldIncludeScripts() ) {
@@ -603,7 +603,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
 
                // Styles
                if ( $context->shouldIncludeStyles() ) {
-                       $styles = array();
+                       $styles = [];
                        // Don't create empty stylesheets like array( '' => '' ) for modules
                        // that don't *have* any stylesheets (bug 38024).
                        $stylePairs = $this->getStyles( $context );
@@ -611,9 +611,9 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
                                // If we are in debug mode without &only= set, we'll want to return an array of URLs
                                // See comment near shouldIncludeScripts() for more details
                                if ( $context->getDebug() && !$context->getOnly() && $this->supportsURLLoading() ) {
-                                       $styles = array(
+                                       $styles = [
                                                'url' => $this->getStyleURLsForDebug( $context )
-                                       );
+                                       ];
                                } else {
                                        // Minify CSS before embedding in mw.loader.implement call
                                        // (unless in debug mode)
@@ -621,7 +621,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
                                                foreach ( $stylePairs as $media => $style ) {
                                                        // Can be either a string or an array of strings.
                                                        if ( is_array( $style ) ) {
-                                                               $stylePairs[$media] = array();
+                                                               $stylePairs[$media] = [];
                                                                foreach ( $style as $cssText ) {
                                                                        if ( is_string( $cssText ) ) {
                                                                                $stylePairs[$media][] =
@@ -634,9 +634,9 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
                                                }
                                        }
                                        // Wrap styles into @media groups as needed and flatten into a numerical array
-                                       $styles = array(
+                                       $styles = [
                                                'css' => $rl->makeCombinedStyles( $stylePairs )
-                                       );
+                                       ];
                                }
                        }
                        $content['styles'] = $styles;
@@ -688,7 +688,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
                // Typically, the request for the startup module itself has only=scripts. That must apply
                // only to the startup module content, and not to the module version computed here.
                $context = new DerivativeResourceLoaderContext( $context );
-               $context->setModules( array() );
+               $context->setModules( [] );
                // Version hash must cover all resources, regardless of startup request itself.
                $context->setOnly( null );
                // Compute version hash based on content, not debug urls.
@@ -785,10 +785,10 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
         * @return array|null
         */
        public function getDefinitionSummary( ResourceLoaderContext $context ) {
-               return array(
+               return [
                        '_class' => get_class( $this ),
                        '_cacheEpoch' => $this->getConfig()->get( 'CacheEpoch' ),
-               );
+               ];
        }
 
        /**