return;
}
// Note: When changing class name discovery logic,
- // AutoLoaderTest.php may also need to be updated.
+ // AutoLoaderStructureTest.php may also need to be updated.
switch ( $token[0] ) {
case T_NAMESPACE:
case T_CLASS:
case T_INTERFACE:
case T_TRAIT:
case T_DOUBLE_COLON:
+ case T_NEW:
$this->startToken = $token;
break;
case T_STRING:
// "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() . '\\';