Merge "Handle missing namespace prefix in XML dumps more gracefully"
[lhc/web/wiklou.git] / includes / json / FormatJson.php
index 285f1ec..0c77a7b 100644 (file)
@@ -94,18 +94,18 @@ class FormatJson {
         * @note These are listed in ECMA-262 (5.1 Ed.), ยง7.3 Line Terminators along with U+000A (LF)
         *       and U+000D (CR). However, PHP already escapes LF and CR according to RFC 4627.
         */
-       private static $badChars = array(
+       private static $badChars = [
                "\xe2\x80\xa8", // U+2028 LINE SEPARATOR
                "\xe2\x80\xa9", // U+2029 PARAGRAPH SEPARATOR
-       );
+       ];
 
        /**
         * Escape sequences for characters listed in FormatJson::$badChars.
         */
-       private static $badCharsEscaped = array(
+       private static $badCharsEscaped = [
                '\u2028', // U+2028 LINE SEPARATOR
                '\u2029', // U+2029 PARAGRAPH SEPARATOR
-       );
+       ];
 
        /**
         * Returns the JSON representation of a value.
@@ -131,7 +131,7 @@ class FormatJson {
 
                static $bug66021;
                if ( $pretty !== false && $bug66021 === null ) {
-                       $bug66021 = json_encode( array(), JSON_PRETTY_PRINT ) !== '[]';
+                       $bug66021 = json_encode( [], JSON_PRETTY_PRINT ) !== '[]';
                }
 
                // PHP escapes '/' to prevent breaking out of inline script blocks using '</script>',
@@ -216,7 +216,7 @@ class FormatJson {
                        $count = 0;
                        $value =
                                preg_replace( '/,([ \t]*[}\]][^"\r\n]*([\r\n]|$)|[ \t]*[\r\n][ \t\r\n]*[}\]])/', '$1',
-                                       $value, - 1, $count );
+                                       $value, -1, $count );
                        if ( $count > 0 ) {
                                $result = json_decode( $value, $assoc );
                                if ( JSON_ERROR_NONE === json_last_error() ) {
@@ -271,7 +271,7 @@ class FormatJson {
         */
        public static function stripComments( $json ) {
                // Ensure we have a string
-               $str = (string) $json;
+               $str = (string)$json;
                $buffer = '';
                $maxLen = strlen( $str );
                $mark = 0;