Skip to content

Commit 7e6104e

Browse files
yoosefapdg
authored andcommitted
Extractor: supports PHP-Parser 5.0 (#150)
1 parent 2cb64f2 commit 7e6104e

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"require-dev": {
2222
"nette/tester": "^2.4",
23-
"nikic/php-parser": "^4.15",
23+
"nikic/php-parser": "^4.18 || ^5.0",
2424
"tracy/tracy": "^2.8",
2525
"phpstan/phpstan": "^1.0",
2626
"jetbrains/phpstorm-attributes": "dev-master"

src/PhpGenerator/Extractor.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ private function parseCode(string $code): void
4747
}
4848

4949
$this->code = Nette\Utils\Strings::normalizeNewlines($code);
50-
$lexer = new PhpParser\Lexer\Emulative(['usedAttributes' => ['startFilePos', 'endFilePos', 'comments']]);
51-
$parser = (new ParserFactory)->create(ParserFactory::ONLY_PHP7, $lexer);
50+
$parser = (new ParserFactory)->createForNewestSupportedVersion();
5251
$stmts = $parser->parse($this->code);
5352

5453
$traverser = new PhpParser\NodeTraverser;

0 commit comments

Comments
 (0)