Merge "Fix error reporting in Special:Undelete"
[lhc/web/wiklou.git] / includes / utils / AutoloadGenerator.php
index 55e228a..8931e3c 100644 (file)
@@ -137,13 +137,11 @@ class AutoloadGenerator {
                // format class-name : path when they get converted into json.
                foreach ( $this->classes as $path => $contained ) {
                        foreach ( $contained as $fqcn ) {
-
                                // Using substr to remove the leading '/'
                                $json[$key][$fqcn] = substr( $path, 1 );
                        }
                }
                foreach ( $this->overrides as $path => $fqcn ) {
-
                        // Using substr to remove the leading '/'
                        $json[$key][$fqcn] = substr( $path, 1 );
                }
@@ -152,7 +150,7 @@ class AutoloadGenerator {
                ksort( $json[$key] );
 
                // Return the whole JSON file
-               return FormatJson::encode( $json, true ) . "\n";
+               return FormatJson::encode( $json, "\t", FormatJson::ALL_OK ) . "\n";
        }
 
        /**
@@ -212,7 +210,6 @@ global \${$this->variableName};
 ];
 
 EOD;
-
        }
 
        /**
@@ -224,7 +221,6 @@ EOD;
         * @return string
         */
        public function getAutoload( $commandName = 'AutoloadGenerator' ) {
-
                // We need to check whether an extenson.json or skin.json exists or not, and
                // incase it doesn't, update the autoload.php file.
 
@@ -432,6 +428,15 @@ class ClassCollector {
                                        $this->classes[] = $this->alias['name'];
                                        $this->alias = null;
                                        $this->startToken = null;
+                               } elseif ( !is_array( $token ) || (
+                                       $token[0] !== T_STRING &&
+                                       $token[0] !== T_DOUBLE_COLON &&
+                                       $token[0] !== T_CLASS &&
+                                       $token[0] !== T_WHITESPACE
+                               ) ) {
+                                       // Ignore this call to class_alias() - compat/Timestamp.php
+                                       $this->alias = null;
+                                       $this->startToken = null;
                                }
                        }
                        break;