File tree Expand file tree Collapse file tree 3 files changed +5
-17
lines changed
Expand file tree Collapse file tree 3 files changed +5
-17
lines changed Original file line number Diff line number Diff line change 1010 }
1111 ],
1212 "require" : {
13- "nikic/php-parser" : " ^4.10.3 " ,
13+ "nikic/php-parser" : " ^5 " ,
1414 "illuminate/support" : " *"
1515 },
1616 "require-dev" : {
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ public function evaluate($node, $context = [])
2323 } elseif ($ node instanceof DNumber) {
2424 return floatval ($ node ->value );
2525 } elseif ($ node instanceof ConstFetch) {
26- return $ this ->getConstantValue ($ node ->name ->parts [0 ]);
26+ return $ this ->getConstantValue ($ node ->name ->getParts () [0 ]);
2727 } elseif ($ node instanceof Array_) {
2828 return $ this ->evaluateArray ($ node , $ context );
2929 } elseif ($ node instanceof String_) {
@@ -62,7 +62,7 @@ protected function getNestedPath(PropertyFetch $propertyFetch)
6262 protected function evaluateFunctionCall (FuncCall $ funcCall , $ context )
6363 {
6464 $ runtimeMethod = new MethodCall ();
65- $ runtimeMethod ->name = $ funcCall ->name ->parts [0 ];
65+ $ runtimeMethod ->name = $ funcCall ->name ->getParts () [0 ];
6666
6767 foreach ($ funcCall ->args as $ arg ) {
6868 if ($ arg instanceof Arg) {
Original file line number Diff line number Diff line change 33namespace Stillat \Primitives ;
44
55use Illuminate \Support \Str ;
6- use PhpParser \Lexer \Emulative ;
76use PhpParser \Node \Arg ;
87use PhpParser \Parser \Php7 ;
8+ use PhpParser \ParserFactory ;
99use PhpParser \PrettyPrinter \Standard ;
1010
1111class Parser
@@ -15,21 +15,9 @@ class Parser
1515 */
1616 protected $ parser ;
1717
18- /**
19- * @var Emulative
20- */
21- protected $ lexer = null ;
22-
2318 public function __construct ()
2419 {
25- $ this ->lexer = new Emulative ([
26- 'usedAttributes ' => [
27- 'comments ' ,
28- 'startLine ' , 'endLine ' ,
29- 'startTokenPos ' , 'endTokenPos ' ,
30- ],
31- ]);
32- $ this ->parser = new Php7 ($ this ->lexer );
20+ $ this ->parser = (new ParserFactory ())->createForNewestSupportedVersion ();
3321 }
3422
3523 /**
You can’t perform that action at this time.
0 commit comments