Convert all array() syntax to []
[lhc/web/wiklou.git] / includes / libs / CSSMin.php
index 246de75..5f4dda9 100644 (file)
@@ -45,7 +45,7 @@ class CSSMin {
        /* Protected Static Members */
 
        /** @var array List of common image files extensions and MIME-types */
-       protected static $mimeTypes = array(
+       protected static $mimeTypes = [
                'gif' => 'image/gif',
                'jpe' => 'image/jpeg',
                'jpeg' => 'image/jpeg',
@@ -55,7 +55,7 @@ class CSSMin {
                'tiff' => 'image/tiff',
                'xbm' => 'image/x-xbitmap',
                'svg' => 'image/svg+xml',
-       );
+       ];
 
        /* Static Methods */
 
@@ -73,7 +73,7 @@ class CSSMin {
         */
        public static function getLocalFileReferences( $source, $path = null ) {
                if ( $path === null ) {
-                       return array();
+                       return [];
                }
 
                $files = self::getAllLocalFileReferences( $source, $path );
@@ -97,7 +97,7 @@ class CSSMin {
        public static function getAllLocalFileReferences( $source, $path ) {
                $stripped = preg_replace( '/' . self::COMMENT_REGEX . '/s', '', $source );
                $path = rtrim( $path, '/' ) . '/';
-               $files = array();
+               $files = [];
 
                $rFlags = PREG_OFFSET_CAPTURE | PREG_SET_ORDER;
                if ( preg_match_all( '/' . self::URL_REGEX . '/', $stripped, $matches, $rFlags ) ) {
@@ -192,7 +192,7 @@ class CSSMin {
                if ( strstr( $value, "\0" ) ) {
                        throw new Exception( "Invalid character in CSS string" );
                }
-               $value = strtr( $value, array( '\\' => '\\\\', '"' => '\\"' ) );
+               $value = strtr( $value, [ '\\' => '\\\\', '"' => '\\"' ] );
                $value = preg_replace_callback( '/[\x01-\x1f\x7f-\x9f]/', function ( $match ) {
                        return '\\' . base_convert( ord( $match[0] ), 10, 16 ) . ' ';
                }, $value );
@@ -239,7 +239,7 @@ class CSSMin {
                if ( preg_match( '!^[\w\d:@/~.%+;,?&=-]+$!', $url ) ) {
                        return "url($url)";
                } else {
-                       return 'url("' . strtr( $url, array( '\\' => '\\\\', '"' => '\\"' ) ) . '")';
+                       return 'url("' . strtr( $url, [ '\\' => '\\\\', '"' => '\\"' ] ) . '")';
                }
        }
 
@@ -277,7 +277,7 @@ class CSSMin {
                // Replace all comments by a placeholder so they will not interfere with the remapping.
                // Warning: This will also catch on anything looking like the start of a comment between
                // quotation marks (e.g. "foo /* bar").
-               $comments = array();
+               $comments = [];
 
                $pattern = '/(?!' . CSSMin::EMBED_REGEX . ')(' . CSSMin::COMMENT_REGEX . ')/s';
 
@@ -332,7 +332,7 @@ class CSSMin {
 
                                if ( $embedData ) {
                                        // Remember the occurring MIME types to avoid fallbacks when embedding some files.
-                                       $mimeTypes = array();
+                                       $mimeTypes = [];
 
                                        $ruleWithEmbedded = preg_replace_callback(
                                                $pattern,
@@ -361,7 +361,7 @@ class CSSMin {
                                        );
 
                                        // Are all referenced images SVGs?
-                                       $needsEmbedFallback = $mimeTypes !== array( 'image/svg+xml' => true );
+                                       $needsEmbedFallback = $mimeTypes !== [ 'image/svg+xml' => true ];
                                }
 
                                if ( !$embedData || $ruleWithEmbedded === $ruleWithRemapped ) {
@@ -483,9 +483,9 @@ class CSSMin {
        public static function minify( $css ) {
                return trim(
                        str_replace(
-                               array( '; ', ': ', ' {', '{ ', ', ', '} ', ';}' ),
-                               array( ';', ':', '{', '{', ',', '}', '}' ),
-                               preg_replace( array( '/\s+/', '/\/\*.*?\*\//s' ), array( ' ', '' ), $css )
+                               [ '; ', ': ', ' {', '{ ', ', ', '} ', ';}' ],
+                               [ ';', ':', '{', '{', ',', '}', '}' ],
+                               preg_replace( [ '/\s+/', '/\/\*.*?\*\//s' ], [ ' ', '' ], $css )
                        )
                );
        }