Merge "resourceloader: Make various CSSMin performance optimizations and cleanups"
[lhc/web/wiklou.git] / includes / utils / AutoloadGenerator.php
index d12531b..98d2c0e 100644 (file)
@@ -236,11 +236,10 @@ class AutoloadGenerator {
                }
 
                $output = implode( "\n\t", $content );
-               return
-                       <<<EOD
+               return <<<EOD
 <?php
 // This file is generated by $commandName, do not adjust manually
-// @codingStandardsIgnoreFile
+// phpcs:disable Generic.Files.LineLength
 global \${$this->variableName};
 
 \${$this->variableName} {$op} [
@@ -397,6 +396,7 @@ class ClassCollector {
                        case T_INTERFACE:
                        case T_TRAIT:
                        case T_DOUBLE_COLON:
+                       case T_NEW:
                                $this->startToken = $token;
                                break;
                        case T_STRING:
@@ -419,6 +419,12 @@ class ClassCollector {
                                // "self::static" which accesses the class name. It doens't define a new class.
                                $this->startToken = null;
                                break;
+                       case T_NEW:
+                               // Skip over T_CLASS after T_NEW because this is a PHP 7 anonymous class.
+                               if ( !is_array( $token ) || $token[0] !== T_WHITESPACE ) {
+                                       $this->startToken = null;
+                               }
+                               break;
                        case T_NAMESPACE:
                                if ( $token === ';' || $token === '{' ) {
                                        $this->namespace = $this->implodeTokens() . '\\';