Skip to content

Commit

Permalink
Extractor: supports PHP-Parser 5.0 (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoosefap authored and dg committed Jan 17, 2024
1 parent 2cb64f2 commit 7e6104e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"require-dev": {
"nette/tester": "^2.4",
"nikic/php-parser": "^4.15",
"nikic/php-parser": "^4.18 || ^5.0",
"tracy/tracy": "^2.8",
"phpstan/phpstan": "^1.0",
"jetbrains/phpstorm-attributes": "dev-master"
Expand Down
3 changes: 1 addition & 2 deletions src/PhpGenerator/Extractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ private function parseCode(string $code): void
}

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

$traverser = new PhpParser\NodeTraverser;
Expand Down

0 comments on commit 7e6104e

Please sign in to comment.