Skip to content

Commit

Permalink
Fixes for #423 (#424)
Browse files Browse the repository at this point in the history
* Update php7.php

* Update StaticAnalyser.php

* Update StaticAnalyser.php
  • Loading branch information
schodemeiss authored and bfanger committed Aug 9, 2017
1 parent 1b46cff commit 56b0d87
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/StaticAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ protected function fromTokens($tokens, $parseContext)
}
$token = $this->nextToken($tokens, $parseContext);

if (is_string($token) && $token === '{') {
// php7 anonymous classes (i.e. new class { public function foo() {} };)
if (is_string($token) && ($token === '(' || $token === '{')) {
// php7 anonymous classes (i.e. new class() { public function foo() {} };)
continue;
}

Expand Down
12 changes: 12 additions & 0 deletions tests/Fixtures/php7.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@ public function foo()

$o = new class implements foo {
};

$o = new class() {
public function foo()
{
}
};

$o = new class() extends stdClass {
};

$o = new class() implements foo {
};

0 comments on commit 56b0d87

Please sign in to comment.