File tree Expand file tree Collapse file tree 3 files changed +4
-5
lines changed
tests/PhpGenerator/fixtures Expand file tree Collapse file tree 3 files changed +4
-5
lines changed Original file line number Diff line number Diff line change 20
20
},
21
21
"require-dev" : {
22
22
"nette/tester" : " ^2.4" ,
23
- "nikic/php-parser" : " ^4.15 " ,
23
+ "nikic/php-parser" : " ^5.0 " ,
24
24
"tracy/tracy" : " ^2.8" ,
25
25
"phpstan/phpstan" : " ^1.0" ,
26
26
"jetbrains/phpstorm-attributes" : " dev-master"
Original file line number Diff line number Diff line change @@ -46,9 +46,8 @@ private function parseCode(string $code): void
46
46
throw new Nette \InvalidStateException ('The input string is not a PHP code. ' );
47
47
}
48
48
49
- $ 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 );
49
+ $ this ->code = Nette \Utils \Strings::unixNewLines ($ code );
50
+ $ parser = (new ParserFactory )->createForNewestSupportedVersion ();
52
51
$ stmts = $ parser ->parse ($ this ->code );
53
52
54
53
$ traverser = new PhpParser \NodeTraverser ;
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ function comment1()
18
18
function comment2 ()
19
19
{
20
20
// comment
21
- ' bar ' ;
21
+ " bar " ;
22
22
}
23
23
24
24
function comment3 ()
You can’t perform that action at this time.
0 commit comments