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) {
10
10
// Todo https://github.com/glayzzle/php-parser/issues/170
11
11
text = text . replace ( / \? > \n < \? / g, "?>\n___PSEUDO_INLINE_PLACEHOLDER___<?" ) ;
12
12
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
+
13
20
// initialize a new parser instance
14
21
const parser = new engine ( {
15
- parser : {
16
- extractDoc : true ,
17
- } ,
22
+ parser : parserOpts ,
18
23
ast : {
19
24
withPositions : true ,
20
25
withSource : true ,
Original file line number Diff line number Diff line change @@ -13,12 +13,24 @@ new Foo->prop;
13
13
new Foo->method();
14
14
new Foo->$var;
15
15
16
+ new A()
17
+ ->b()
18
+ ->c()
19
+ ->d();
20
+
21
+ $asdf =
22
+ new A()->b() ->c();
23
+
16
24
=====================================output=====================================
17
25
<?php
18
26
19
27
new Foo()->prop;
20
28
new Foo()->method();
21
29
new Foo()->$var;
22
30
31
+ new A()->b()->c()->d();
32
+
33
+ $asdf = new A()->b()->c();
34
+
23
35
================================================================================
24
36
` ;
Original file line number Diff line number Diff line change 3
3
new Foo ->prop;
4
4
new Foo ->method ();
5
5
new 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