From d1b4d97a3ea12922506a08457047784369df1247 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Wed, 2 Mar 2016 19:17:42 +0000 Subject: [PATCH] AutoloadGenerator: Account for PHP 5.5 syntax like "self::static" Bug: T128625 Change-Id: I905b549a738b76c07c56ec92f500553c1d48f558 --- includes/utils/AutoloadGenerator.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/utils/AutoloadGenerator.php b/includes/utils/AutoloadGenerator.php index 254e4e7d2b..916e2f881c 100644 --- a/includes/utils/AutoloadGenerator.php +++ b/includes/utils/AutoloadGenerator.php @@ -311,6 +311,7 @@ class ClassCollector { case T_CLASS: case T_INTERFACE: case T_TRAIT: + case T_DOUBLE_COLON: $this->startToken = $token; } } @@ -322,6 +323,11 @@ class ClassCollector { */ protected function tryEndExpect( $token ) { switch ( $this->startToken[0] ) { + case T_DOUBLE_COLON: + // Skip over T_CLASS after T_DOUBLE_COLON because this is something like + // "self::static" which accesses the class name. It doens't define a new class. + $this->startToken = null; + break; case T_NAMESPACE: if ( $token === ';' || $token === '{' ) { $this->namespace = $this->implodeTokens() . '\\'; -- 2.20.1