Merge "Normalise documentation in tests/selenium"
[lhc/web/wiklou.git] / includes / libs / JavaScriptMinifier.php
index 0b4be9a..998805a 100644 (file)
@@ -59,7 +59,7 @@ class JavaScriptMinifier {
        const TYPE_DO          = 15; // keywords: case, var, finally, else, do, try
        const TYPE_FUNC        = 16; // keywords: function
        const TYPE_LITERAL     = 17; // all literals, identifiers and unrecognised tokens
-       
+
        // Sanity limit to avoid excessive memory usage
        const STACK_LIMIT = 1000;
 
@@ -72,9 +72,9 @@ class JavaScriptMinifier {
         *       literals (e.g. quoted strings) longer than $maxLineLength are encountered
         *       or when required to guard against semicolon insertion.
         *
-        * @param $s String JavaScript code to minify
-        * @param $statementsOnOwnLine Bool Whether to put each statement on its own line
-        * @param $maxLineLength Int Maximum length of a single line, or -1 for no maximum.
+        * @param string $s JavaScript code to minify
+        * @param bool $statementsOnOwnLine Whether to put each statement on its own line
+        * @param int $maxLineLength Maximum length of a single line, or -1 for no maximum.
         * @return String Minified code
         */
        public static function minify( $s, $statementsOnOwnLine = false, $maxLineLength = 1000 ) {
@@ -385,7 +385,7 @@ class JavaScriptMinifier {
                                self::TYPE_LITERAL    => true
                        )
                );
-               
+
                // Rules for when newlines should be inserted if
                // $statementsOnOwnLine is enabled.
                // $newlineBefore is checked before switching state,
@@ -514,7 +514,7 @@ class JavaScriptMinifier {
                                                return self::parseError($s, $end, 'Number with several E' );
                                        }
                                        $end++;
-                                       
+
                                        // + sign is optional; - sign is required.
                                        $end += strspn( $s, '-+', $end );
                                        $len = strspn( $s, '0123456789', $end );
@@ -564,13 +564,13 @@ class JavaScriptMinifier {
                                $out .= ' ';
                                $lineLength++;
                        }
-                       
+
                        $out .= $token;
                        $lineLength += $end - $pos; // += strlen( $token )
                        $last = $s[$end - 1];
                        $pos = $end;
                        $newlineFound = false;
-                       
+
                        // Output a newline after the token if required
                        // This is checked before AND after switching state
                        $newlineAdded = false;
@@ -589,7 +589,7 @@ class JavaScriptMinifier {
                        } elseif( isset( $goto[$state][$type] ) ) {
                                $state = $goto[$state][$type];
                        }
-                       
+
                        // Check for newline insertion again
                        if ( $statementsOnOwnLine && !$newlineAdded && isset( $newlineAfter[$state][$type] ) ) {
                                $out .= "\n";
@@ -598,7 +598,7 @@ class JavaScriptMinifier {
                }
                return $out;
        }
-       
+
        static function parseError($fullJavascript, $position, $errorMsg) {
                // TODO: Handle the error: trigger_error, throw exception, return false...
                return false;