File tree Expand file tree Collapse file tree 3 files changed +28
-3
lines changed
Expand file tree Collapse file tree 3 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,16 @@ function parse(text, opts) {
1010 // Todo https://github.com/glayzzle/php-parser/issues/170
1111 text = text . replace ( / \? > \n < \? / g, "?>\n___PSEUDO_INLINE_PLACEHOLDER___<?" ) ;
1212
13+ const parserOpts = Object . assign (
14+ { extractDoc : true } ,
15+ // only pass the version if user requested 8.4 syntax; parser is stricter
16+ // about allowed syntax than we are and currenly defaults to support for 8.3
17+ opts && opts . phpVersion === "8.4" ? { version : opts . phpVersion } : { }
18+ ) ;
19+
1320 // initialize a new parser instance
1421 const parser = new engine ( {
15- parser : {
16- extractDoc : true ,
17- } ,
22+ parser : parserOpts ,
1823 ast : {
1924 withPositions : true ,
2025 withSource : true ,
Original file line number Diff line number Diff line change @@ -13,12 +13,24 @@ new Foo->prop;
1313new Foo->method();
1414new Foo->$var;
1515
16+ new A()
17+ ->b()
18+ ->c()
19+ ->d();
20+
21+ $asdf =
22+ new A()->b() ->c();
23+
1624=====================================output=====================================
1725<?php
1826
1927new Foo()->prop;
2028new Foo()->method();
2129new Foo()->$var;
2230
31+ new A()->b()->c()->d();
32+
33+ $asdf = new A()->b()->c();
34+
2335================================================================================
2436` ;
Original file line number Diff line number Diff line change 33new Foo ->prop;
44new Foo ->method ();
55new Foo ->$ var ;
6+
7+ new A ()
8+ ->b ()
9+ ->c ()
10+ ->d ();
11+
12+ $ asdf =
13+ new A ()->b () ->c ();
You can’t perform that action at this time.
0 commit comments