Skip to content

Commit

Permalink
Add support for anonymous classes
Browse files Browse the repository at this point in the history
Add support for anonymous classes which extends or implements another class
  • Loading branch information
zim32 authored and bfanger committed May 6, 2020
1 parent 77b7d93 commit 3f256b1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/StaticAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ protected function fromTokens($tokens, $parseContext)
// php7 anonymous classes (i.e. new class() { public function foo() {} };)
continue;
}

if (is_array($token) && ($token[1] === 'extends' || $token[1] === 'implements')) {
// php7 anonymous classes with extends (i.e. new class() extends { public function foo() {} };)
continue;
}

$schemaContext = new Context(['class' => $token[1], 'line' => $token[2]], $parseContext);
if ($classDefinition) {
Expand Down

0 comments on commit 3f256b1

Please sign in to comment.