update v 1.0.7.5
This commit is contained in:
100
vendor/nikic/php-parser/test/code/parser/comments.test
vendored
Normal file
100
vendor/nikic/php-parser/test/code/parser/comments.test
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
Comments
|
||||
-----
|
||||
<?php
|
||||
|
||||
/** doc 1 */
|
||||
/* foobar 1 */
|
||||
// foo 1
|
||||
// bar 1
|
||||
$var;
|
||||
|
||||
if ($cond) {
|
||||
/** doc 2 */
|
||||
/* foobar 2 */
|
||||
// foo 2
|
||||
// bar 2
|
||||
}
|
||||
|
||||
/** doc 3 */
|
||||
/* foobar 3 */
|
||||
// foo 3
|
||||
// bar 3
|
||||
-----
|
||||
array(
|
||||
0: Expr_Variable(
|
||||
name: var
|
||||
comments: array(
|
||||
0: /** doc 1 */
|
||||
1: /* foobar 1 */
|
||||
2: // foo 1
|
||||
3: // bar 1
|
||||
)
|
||||
)
|
||||
1: Stmt_If(
|
||||
cond: Expr_Variable(
|
||||
name: cond
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Nop(
|
||||
comments: array(
|
||||
0: /** doc 2 */
|
||||
1: /* foobar 2 */
|
||||
2: // foo 2
|
||||
3: // bar 2
|
||||
)
|
||||
)
|
||||
)
|
||||
elseifs: array(
|
||||
)
|
||||
else: null
|
||||
)
|
||||
2: Stmt_Nop(
|
||||
comments: array(
|
||||
0: /** doc 3 */
|
||||
1: /* foobar 3 */
|
||||
2: // foo 3
|
||||
3: // bar 3
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
|
||||
/** doc */
|
||||
/* foobar */
|
||||
// foo
|
||||
// bar
|
||||
|
||||
?>
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Nop(
|
||||
comments: array(
|
||||
0: /** doc */
|
||||
1: /* foobar */
|
||||
2: // foo
|
||||
3: // bar
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
|
||||
// comment
|
||||
if (42) {}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_If(
|
||||
cond: Scalar_LNumber(
|
||||
value: 42
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
elseifs: array(
|
||||
)
|
||||
else: null
|
||||
comments: array(
|
||||
0: // comment
|
||||
)
|
||||
)
|
||||
)
|
@@ -10,4 +10,9 @@ array(
|
||||
-----
|
||||
Syntax error, unexpected EOF from 1:20 to 1:20
|
||||
array(
|
||||
0: Stmt_Nop(
|
||||
comments: array(
|
||||
0: /* bar */
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@@ -172,6 +172,11 @@ array(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
3: Stmt_Nop(
|
||||
comments: array(
|
||||
0: // The output here drops the loop - would require Error node to handle this
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
|
@@ -97,6 +97,9 @@ array(
|
||||
5: Expr_Array(
|
||||
items: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // short array syntax
|
||||
)
|
||||
)
|
||||
6: Expr_Array(
|
||||
items: array(
|
||||
|
@@ -40,18 +40,30 @@ array(
|
||||
0: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // simple assign
|
||||
)
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
comments: array(
|
||||
0: // simple assign
|
||||
)
|
||||
)
|
||||
1: Expr_AssignOp_BitwiseAnd(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // combined assign
|
||||
)
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
comments: array(
|
||||
0: // combined assign
|
||||
)
|
||||
)
|
||||
2: Expr_AssignOp_BitwiseOr(
|
||||
var: Expr_Variable(
|
||||
@@ -144,6 +156,9 @@ array(
|
||||
13: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // chained assign
|
||||
)
|
||||
)
|
||||
expr: Expr_AssignOp_Mul(
|
||||
var: Expr_Variable(
|
||||
@@ -158,14 +173,23 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // chained assign
|
||||
)
|
||||
)
|
||||
14: Expr_AssignRef(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // by ref assign
|
||||
)
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
comments: array(
|
||||
0: // by ref assign
|
||||
)
|
||||
)
|
||||
15: Expr_AssignRef(
|
||||
var: Expr_Variable(
|
||||
@@ -188,10 +212,16 @@ array(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // list() assign
|
||||
)
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
comments: array(
|
||||
0: // list() assign
|
||||
)
|
||||
)
|
||||
17: Expr_Assign(
|
||||
var: Expr_List(
|
||||
@@ -236,6 +266,9 @@ array(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
comments: array(
|
||||
0: // inc/dec
|
||||
)
|
||||
)
|
||||
20: Expr_PostInc(
|
||||
var: Expr_Variable(
|
||||
|
@@ -21,9 +21,15 @@ array(
|
||||
parts: array(
|
||||
0: a
|
||||
)
|
||||
comments: array(
|
||||
0: // function name variations
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // function name variations
|
||||
)
|
||||
)
|
||||
1: Expr_FuncCall(
|
||||
name: Expr_Variable(
|
||||
@@ -106,12 +112,21 @@ array(
|
||||
parts: array(
|
||||
0: a
|
||||
)
|
||||
comments: array(
|
||||
0: // array dereferencing
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // array dereferencing
|
||||
)
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
comments: array(
|
||||
0: // array dereferencing
|
||||
)
|
||||
)
|
||||
)
|
@@ -17,12 +17,19 @@ $a->$b['c']();
|
||||
$a->b()['c'];
|
||||
$a->b(){'c'}; // invalid PHP: drop Support?
|
||||
-----
|
||||
!!php5
|
||||
array(
|
||||
0: Expr_PropertyFetch(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // property fetch variations
|
||||
)
|
||||
)
|
||||
name: b
|
||||
comments: array(
|
||||
0: // property fetch variations
|
||||
)
|
||||
)
|
||||
1: Expr_ArrayDimFetch(
|
||||
var: Expr_PropertyFetch(
|
||||
@@ -49,10 +56,16 @@ array(
|
||||
3: Expr_MethodCall(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // method call variations
|
||||
)
|
||||
)
|
||||
name: b
|
||||
args: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // method call variations
|
||||
)
|
||||
)
|
||||
4: Expr_MethodCall(
|
||||
var: Expr_Variable(
|
||||
@@ -93,14 +106,23 @@ array(
|
||||
var: Expr_MethodCall(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // array dereferencing
|
||||
)
|
||||
)
|
||||
name: b
|
||||
args: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // array dereferencing
|
||||
)
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: c
|
||||
)
|
||||
comments: array(
|
||||
0: // array dereferencing
|
||||
)
|
||||
)
|
||||
8: Expr_ArrayDimFetch(
|
||||
var: Expr_MethodCall(
|
||||
@@ -115,4 +137,9 @@ array(
|
||||
value: c
|
||||
)
|
||||
)
|
||||
9: Stmt_Nop(
|
||||
comments: array(
|
||||
0: // invalid PHP: drop Support?
|
||||
)
|
||||
)
|
||||
)
|
@@ -18,16 +18,23 @@ $a::b();
|
||||
${'a'}::b();
|
||||
$a['b']::c();
|
||||
-----
|
||||
!!php5
|
||||
array(
|
||||
0: Expr_StaticCall(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
comments: array(
|
||||
0: // method name variations
|
||||
)
|
||||
)
|
||||
name: b
|
||||
args: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // method name variations
|
||||
)
|
||||
)
|
||||
1: Expr_StaticCall(
|
||||
class: Name(
|
||||
@@ -98,24 +105,39 @@ array(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
comments: array(
|
||||
0: // array dereferencing
|
||||
)
|
||||
)
|
||||
name: b
|
||||
args: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // array dereferencing
|
||||
)
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: c
|
||||
)
|
||||
comments: array(
|
||||
0: // array dereferencing
|
||||
)
|
||||
)
|
||||
6: Expr_StaticCall(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: static
|
||||
)
|
||||
comments: array(
|
||||
0: // class name variations
|
||||
)
|
||||
)
|
||||
name: b
|
||||
args: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // class name variations
|
||||
)
|
||||
)
|
||||
7: Expr_StaticCall(
|
||||
class: Expr_Variable(
|
||||
|
@@ -19,8 +19,14 @@ array(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
comments: array(
|
||||
0: // property name variations
|
||||
)
|
||||
)
|
||||
name: b
|
||||
comments: array(
|
||||
0: // property name variations
|
||||
)
|
||||
)
|
||||
1: Expr_StaticPropertyFetch(
|
||||
class: Name(
|
||||
@@ -48,12 +54,21 @@ array(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
comments: array(
|
||||
0: // array access
|
||||
)
|
||||
)
|
||||
name: b
|
||||
comments: array(
|
||||
0: // array access
|
||||
)
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: c
|
||||
)
|
||||
comments: array(
|
||||
0: // array access
|
||||
)
|
||||
)
|
||||
4: Expr_ArrayDimFetch(
|
||||
var: Expr_StaticPropertyFetch(
|
||||
@@ -68,4 +83,9 @@ array(
|
||||
value: c
|
||||
)
|
||||
)
|
||||
5: Stmt_Nop(
|
||||
comments: array(
|
||||
0: // class name variations can be found in staticCall.test
|
||||
)
|
||||
)
|
||||
)
|
@@ -24,10 +24,16 @@ array(
|
||||
0: Expr_BinaryOp_BooleanAnd(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // boolean ops
|
||||
)
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
comments: array(
|
||||
0: // boolean ops
|
||||
)
|
||||
)
|
||||
1: Expr_BinaryOp_BooleanOr(
|
||||
left: Expr_Variable(
|
||||
@@ -52,10 +58,16 @@ array(
|
||||
4: Expr_BinaryOp_LogicalAnd(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // logical ops
|
||||
)
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
comments: array(
|
||||
0: // logical ops
|
||||
)
|
||||
)
|
||||
5: Expr_BinaryOp_LogicalOr(
|
||||
left: Expr_Variable(
|
||||
@@ -77,10 +89,16 @@ array(
|
||||
left: Expr_BinaryOp_BooleanAnd(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // precedence
|
||||
)
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
comments: array(
|
||||
0: // precedence
|
||||
)
|
||||
)
|
||||
right: Expr_BinaryOp_BooleanAnd(
|
||||
left: Expr_Variable(
|
||||
@@ -90,6 +108,9 @@ array(
|
||||
name: d
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // precedence
|
||||
)
|
||||
)
|
||||
8: Expr_BinaryOp_BooleanAnd(
|
||||
left: Expr_BinaryOp_BooleanAnd(
|
||||
|
@@ -38,6 +38,9 @@ array(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
comments: array(
|
||||
0: // unary ops
|
||||
)
|
||||
)
|
||||
1: Expr_UnaryPlus(
|
||||
expr: Expr_Variable(
|
||||
@@ -52,10 +55,16 @@ array(
|
||||
3: Expr_BinaryOp_BitwiseAnd(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // binary ops
|
||||
)
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
comments: array(
|
||||
0: // binary ops
|
||||
)
|
||||
)
|
||||
4: Expr_BinaryOp_BitwiseOr(
|
||||
left: Expr_Variable(
|
||||
@@ -149,14 +158,23 @@ array(
|
||||
left: Expr_BinaryOp_Mul(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // associativity
|
||||
)
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
comments: array(
|
||||
0: // associativity
|
||||
)
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
comments: array(
|
||||
0: // associativity
|
||||
)
|
||||
)
|
||||
16: Expr_BinaryOp_Mul(
|
||||
left: Expr_Variable(
|
||||
@@ -174,6 +192,9 @@ array(
|
||||
17: Expr_BinaryOp_Plus(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // precedence
|
||||
)
|
||||
)
|
||||
right: Expr_BinaryOp_Mul(
|
||||
left: Expr_Variable(
|
||||
@@ -183,6 +204,9 @@ array(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // precedence
|
||||
)
|
||||
)
|
||||
18: Expr_BinaryOp_Mul(
|
||||
left: Expr_BinaryOp_Plus(
|
||||
@@ -200,6 +224,9 @@ array(
|
||||
19: Expr_BinaryOp_Pow(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // pow is special
|
||||
)
|
||||
)
|
||||
right: Expr_BinaryOp_Pow(
|
||||
left: Expr_Variable(
|
||||
@@ -209,6 +236,9 @@ array(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // pow is special
|
||||
)
|
||||
)
|
||||
20: Expr_BinaryOp_Pow(
|
||||
left: Expr_BinaryOp_Pow(
|
||||
|
@@ -14,12 +14,16 @@ array(
|
||||
)
|
||||
1: Expr_ShellExec(
|
||||
parts: array(
|
||||
0: test
|
||||
0: Scalar_EncapsedStringPart(
|
||||
value: test
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Expr_ShellExec(
|
||||
parts: array(
|
||||
0: test
|
||||
0: Scalar_EncapsedStringPart(
|
||||
value: test
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: A
|
||||
)
|
||||
@@ -27,12 +31,16 @@ array(
|
||||
)
|
||||
3: Expr_ShellExec(
|
||||
parts: array(
|
||||
0: test `
|
||||
0: Scalar_EncapsedStringPart(
|
||||
value: test `
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Expr_ShellExec(
|
||||
parts: array(
|
||||
0: test \"
|
||||
0: Scalar_EncapsedStringPart(
|
||||
value: test \"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -20,6 +20,9 @@ array(
|
||||
0: Expr_Ternary(
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // ternary
|
||||
)
|
||||
)
|
||||
if: Expr_Variable(
|
||||
name: b
|
||||
@@ -27,6 +30,9 @@ array(
|
||||
else: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
comments: array(
|
||||
0: // ternary
|
||||
)
|
||||
)
|
||||
1: Expr_Ternary(
|
||||
cond: Expr_Variable(
|
||||
@@ -41,6 +47,9 @@ array(
|
||||
cond: Expr_Ternary(
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // precedence
|
||||
)
|
||||
)
|
||||
if: Expr_Variable(
|
||||
name: b
|
||||
@@ -48,6 +57,9 @@ array(
|
||||
else: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
comments: array(
|
||||
0: // precedence
|
||||
)
|
||||
)
|
||||
if: Expr_Variable(
|
||||
name: d
|
||||
@@ -55,6 +67,9 @@ array(
|
||||
else: Expr_Variable(
|
||||
name: e
|
||||
)
|
||||
comments: array(
|
||||
0: // precedence
|
||||
)
|
||||
)
|
||||
3: Expr_Ternary(
|
||||
cond: Expr_Variable(
|
||||
@@ -78,10 +93,16 @@ array(
|
||||
4: Expr_BinaryOp_Coalesce(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // null coalesce
|
||||
)
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
comments: array(
|
||||
0: // null coalesce
|
||||
)
|
||||
)
|
||||
5: Expr_BinaryOp_Coalesce(
|
||||
left: Expr_Variable(
|
||||
@@ -125,4 +146,4 @@ array(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
16
vendor/nikic/php-parser/test/code/parser/expr/uvs/globalNonSimpleVarError.test
vendored
Normal file
16
vendor/nikic/php-parser/test/code/parser/expr/uvs/globalNonSimpleVarError.test
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
Non-simple variables are forbidden in PHP 7
|
||||
-----
|
||||
<?php
|
||||
global $$foo->bar;
|
||||
-----
|
||||
!!php7
|
||||
Syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' from 2:13 to 2:14
|
||||
array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: bar
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
481
vendor/nikic/php-parser/test/code/parser/expr/uvs/indirectCall.test
vendored
Normal file
481
vendor/nikic/php-parser/test/code/parser/expr/uvs/indirectCall.test
vendored
Normal file
@@ -0,0 +1,481 @@
|
||||
UVS indirect calls
|
||||
-----
|
||||
<?php
|
||||
|
||||
id('var_dump')(1);
|
||||
id('id')('var_dump')(2);
|
||||
id()()('var_dump')(4);
|
||||
id(['udef', 'id'])[1]()('var_dump')(5);
|
||||
(function($x) { return $x; })('id')('var_dump')(8);
|
||||
($f = function($x = null) use (&$f) {
|
||||
return $x ?: $f;
|
||||
})()()()('var_dump')(9);
|
||||
[$obj, 'id']()('id')($id)('var_dump')(10);
|
||||
'id'()('id')('var_dump')(12);
|
||||
('i' . 'd')()('var_dump')(13);
|
||||
'\id'('var_dump')(14);
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: id
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_String(
|
||||
value: var_dump
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: id
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_String(
|
||||
value: id
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_String(
|
||||
value: var_dump
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: id
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_String(
|
||||
value: var_dump
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_LNumber(
|
||||
value: 4
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_ArrayDimFetch(
|
||||
var: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: id
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: udef
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: id
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_String(
|
||||
value: var_dump
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_LNumber(
|
||||
value: 5
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_Closure(
|
||||
static: false
|
||||
byRef: false
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: x
|
||||
default: null
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
0: Stmt_Return(
|
||||
expr: Expr_Variable(
|
||||
name: x
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_String(
|
||||
value: id
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_String(
|
||||
value: var_dump
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_LNumber(
|
||||
value: 8
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
name: f
|
||||
)
|
||||
expr: Expr_Closure(
|
||||
static: false
|
||||
byRef: false
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: x
|
||||
default: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Expr_ClosureUse(
|
||||
var: f
|
||||
byRef: true
|
||||
)
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
0: Stmt_Return(
|
||||
expr: Expr_Ternary(
|
||||
cond: Expr_Variable(
|
||||
name: x
|
||||
)
|
||||
if: null
|
||||
else: Expr_Variable(
|
||||
name: f
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_String(
|
||||
value: var_dump
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_LNumber(
|
||||
value: 9
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
6: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: obj
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: id
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_String(
|
||||
value: id
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Variable(
|
||||
name: id
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_String(
|
||||
value: var_dump
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_LNumber(
|
||||
value: 10
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
7: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Scalar_String(
|
||||
value: id
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_String(
|
||||
value: id
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_String(
|
||||
value: var_dump
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_LNumber(
|
||||
value: 12
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
8: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: i
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: d
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_String(
|
||||
value: var_dump
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_LNumber(
|
||||
value: 13
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
9: Expr_FuncCall(
|
||||
name: Expr_FuncCall(
|
||||
name: Scalar_String(
|
||||
value: \id
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_String(
|
||||
value: var_dump
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_LNumber(
|
||||
value: 14
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
74
vendor/nikic/php-parser/test/code/parser/expr/uvs/isset.test
vendored
Normal file
74
vendor/nikic/php-parser/test/code/parser/expr/uvs/isset.test
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
UVS isset() on temporaries
|
||||
-----
|
||||
<?php
|
||||
|
||||
isset(([0, 1] + [])[0]);
|
||||
isset(['a' => 'b']->a);
|
||||
isset("str"->a);
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Expr_Isset(
|
||||
vars: array(
|
||||
0: Expr_ArrayDimFetch(
|
||||
var: Expr_BinaryOp_Plus(
|
||||
left: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
right: Expr_Array(
|
||||
items: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Expr_Isset(
|
||||
vars: array(
|
||||
0: Expr_PropertyFetch(
|
||||
var: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
name: a
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Expr_Isset(
|
||||
vars: array(
|
||||
0: Expr_PropertyFetch(
|
||||
var: Scalar_String(
|
||||
value: str
|
||||
)
|
||||
name: a
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
109
vendor/nikic/php-parser/test/code/parser/expr/uvs/misc.test
vendored
Normal file
109
vendor/nikic/php-parser/test/code/parser/expr/uvs/misc.test
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
Uniform variable syntax in PHP 7 (misc)
|
||||
-----
|
||||
<?php
|
||||
|
||||
A::A[0];
|
||||
A::A[0][1][2];
|
||||
"string"->length();
|
||||
(clone $obj)->b[0](1);
|
||||
[0, 1][0] = 1;
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Expr_ArrayDimFetch(
|
||||
var: Expr_ClassConstFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: A
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
1: Expr_ArrayDimFetch(
|
||||
var: Expr_ArrayDimFetch(
|
||||
var: Expr_ArrayDimFetch(
|
||||
var: Expr_ClassConstFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: A
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
2: Expr_MethodCall(
|
||||
var: Scalar_String(
|
||||
value: string
|
||||
)
|
||||
name: length
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
3: Expr_FuncCall(
|
||||
name: Expr_ArrayDimFetch(
|
||||
var: Expr_PropertyFetch(
|
||||
var: Expr_Clone(
|
||||
expr: Expr_Variable(
|
||||
name: obj
|
||||
)
|
||||
)
|
||||
name: b
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Expr_Assign(
|
||||
var: Expr_ArrayDimFetch(
|
||||
var: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
expr: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
95
vendor/nikic/php-parser/test/code/parser/expr/uvs/new.test
vendored
Normal file
95
vendor/nikic/php-parser/test/code/parser/expr/uvs/new.test
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
UVS new expressions
|
||||
-----
|
||||
<?php
|
||||
new $className;
|
||||
new $array['className'];
|
||||
new $array{'className'};
|
||||
new $obj->className;
|
||||
new Test::$className;
|
||||
new $test::$className;
|
||||
new $weird[0]->foo::$className;
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Expr_New(
|
||||
class: Expr_Variable(
|
||||
name: className
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
1: Expr_New(
|
||||
class: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: array
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: className
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
2: Expr_New(
|
||||
class: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: array
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: className
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
3: Expr_New(
|
||||
class: Expr_PropertyFetch(
|
||||
var: Expr_Variable(
|
||||
name: obj
|
||||
)
|
||||
name: className
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
4: Expr_New(
|
||||
class: Expr_StaticPropertyFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: Test
|
||||
)
|
||||
)
|
||||
name: className
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
5: Expr_New(
|
||||
class: Expr_StaticPropertyFetch(
|
||||
class: Expr_Variable(
|
||||
name: test
|
||||
)
|
||||
name: className
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
6: Expr_New(
|
||||
class: Expr_StaticPropertyFetch(
|
||||
class: Expr_PropertyFetch(
|
||||
var: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: weird
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
name: foo
|
||||
)
|
||||
name: className
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
93
vendor/nikic/php-parser/test/code/parser/expr/uvs/staticProperty.test
vendored
Normal file
93
vendor/nikic/php-parser/test/code/parser/expr/uvs/staticProperty.test
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
UVS static access
|
||||
-----
|
||||
<?php
|
||||
A::$b;
|
||||
$A::$b;
|
||||
'A'::$b;
|
||||
('A' . '')::$b;
|
||||
'A'[0]::$b;
|
||||
A::$$b;
|
||||
A::$$c[1];
|
||||
A::$A::$b;
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Expr_StaticPropertyFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: b
|
||||
)
|
||||
1: Expr_StaticPropertyFetch(
|
||||
class: Expr_Variable(
|
||||
name: A
|
||||
)
|
||||
name: b
|
||||
)
|
||||
2: Expr_StaticPropertyFetch(
|
||||
class: Scalar_String(
|
||||
value: A
|
||||
)
|
||||
name: b
|
||||
)
|
||||
3: Expr_StaticPropertyFetch(
|
||||
class: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: A
|
||||
)
|
||||
right: Scalar_String(
|
||||
value:
|
||||
)
|
||||
)
|
||||
name: b
|
||||
)
|
||||
4: Expr_StaticPropertyFetch(
|
||||
class: Expr_ArrayDimFetch(
|
||||
var: Scalar_String(
|
||||
value: A
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
name: b
|
||||
)
|
||||
5: Expr_StaticPropertyFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
6: Expr_ArrayDimFetch(
|
||||
var: Expr_StaticPropertyFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
7: Expr_StaticPropertyFetch(
|
||||
class: Expr_StaticPropertyFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: A
|
||||
)
|
||||
name: b
|
||||
)
|
||||
)
|
@@ -9,6 +9,7 @@ $$a;
|
||||
$$$a;
|
||||
$$a['b'];
|
||||
-----
|
||||
!!php5
|
||||
array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
@@ -51,4 +52,4 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@@ -8,8 +8,10 @@ b'';
|
||||
b"";
|
||||
'Hi';
|
||||
b'Hi';
|
||||
B'Hi';
|
||||
"Hi";
|
||||
b"Hi";
|
||||
B"Hi";
|
||||
'!\'!\\!\a!';
|
||||
"!\"!\\!\$!\n!\r!\t!\f!\v!\e!\a";
|
||||
"!\xFF!\377!\400!\0!";
|
||||
@@ -40,14 +42,19 @@ array(
|
||||
value: Hi
|
||||
)
|
||||
8: Scalar_String(
|
||||
value: !'!\!\a!
|
||||
value: Hi
|
||||
)
|
||||
9: Scalar_String(
|
||||
value: !"!\!$!
|
||||
!
|
||||
!@@{ "\t" }@@!@@{ "\f" }@@!@@{ "\v" }@@!@@{ chr(27) /* "\e" */ }@@!\a
|
||||
value: Hi
|
||||
)
|
||||
10: Scalar_String(
|
||||
value: !'!\!\a!
|
||||
)
|
||||
11: Scalar_String(
|
||||
value: !"!\!$!
|
||||
!@@{ "\r" }@@!@@{ "\t" }@@!@@{ "\f" }@@!@@{ "\v" }@@!@@{ chr(27) /* "\e" */ }@@!\a
|
||||
)
|
||||
12: Scalar_String(
|
||||
value: !@@{ chr(255) }@@!@@{ chr(255) }@@!@@{ chr(0) }@@!@@{ chr(0) }@@!
|
||||
)
|
||||
)
|
@@ -24,17 +24,26 @@ EOS;
|
||||
Test $a and $b->c test
|
||||
EOS;
|
||||
|
||||
// comment to force line break before EOF
|
||||
b<<<EOS
|
||||
Binary
|
||||
EOS;
|
||||
|
||||
-----
|
||||
array(
|
||||
0: Scalar_String(
|
||||
value:
|
||||
comments: array(
|
||||
0: // empty strings
|
||||
)
|
||||
)
|
||||
1: Scalar_String(
|
||||
value:
|
||||
)
|
||||
2: Scalar_String(
|
||||
value: Test '" $a \n
|
||||
comments: array(
|
||||
0: // constant encapsed strings
|
||||
)
|
||||
)
|
||||
3: Scalar_String(
|
||||
value: Test '" $a
|
||||
@@ -42,26 +51,40 @@ array(
|
||||
)
|
||||
4: Scalar_Encapsed(
|
||||
parts: array(
|
||||
0: Test
|
||||
0: Scalar_EncapsedStringPart(
|
||||
value: Test
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // encapsed strings
|
||||
)
|
||||
)
|
||||
5: Scalar_Encapsed(
|
||||
parts: array(
|
||||
0: Test
|
||||
0: Scalar_EncapsedStringPart(
|
||||
value: Test
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
2: and
|
||||
2: Scalar_EncapsedStringPart(
|
||||
value: and
|
||||
)
|
||||
3: Expr_PropertyFetch(
|
||||
var: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
name: c
|
||||
)
|
||||
4: test
|
||||
4: Scalar_EncapsedStringPart(
|
||||
value: test
|
||||
)
|
||||
)
|
||||
)
|
||||
6: Scalar_String(
|
||||
value: Binary
|
||||
)
|
||||
)
|
@@ -12,7 +12,6 @@ Trailing newlines in doc strings
|
||||
<<<'EOF'@@{ "\r\nFoo\r\n\r\n" }@@EOF;
|
||||
<<<EOF@@{ "\r\n\$var\r\n\r\n" }@@EOF;
|
||||
|
||||
// comment to force line break before EOF
|
||||
-----
|
||||
array(
|
||||
0: Scalar_String(
|
||||
@@ -31,8 +30,10 @@ array(
|
||||
0: Expr_Variable(
|
||||
name: var
|
||||
)
|
||||
1:
|
||||
1: Scalar_EncapsedStringPart(
|
||||
value:
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Scalar_String(
|
||||
@@ -51,8 +52,10 @@ array(
|
||||
0: Expr_Variable(
|
||||
name: var
|
||||
)
|
||||
1:
|
||||
1: Scalar_EncapsedStringPart(
|
||||
value:
|
||||
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -21,6 +21,7 @@ Encapsed strings
|
||||
"$$A[B]";
|
||||
"A $B C";
|
||||
b"$A";
|
||||
B"$A";
|
||||
-----
|
||||
array(
|
||||
0: Scalar_Encapsed(
|
||||
@@ -137,25 +138,35 @@ array(
|
||||
)
|
||||
11: Scalar_Encapsed(
|
||||
parts: array(
|
||||
0: \{
|
||||
0: Scalar_EncapsedStringPart(
|
||||
value: \{
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: A
|
||||
)
|
||||
2: }
|
||||
2: Scalar_EncapsedStringPart(
|
||||
value: }
|
||||
)
|
||||
)
|
||||
)
|
||||
12: Scalar_Encapsed(
|
||||
parts: array(
|
||||
0: \{
|
||||
0: Scalar_EncapsedStringPart(
|
||||
value: \{
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: A
|
||||
)
|
||||
2: }
|
||||
2: Scalar_EncapsedStringPart(
|
||||
value: }
|
||||
)
|
||||
)
|
||||
)
|
||||
13: Scalar_Encapsed(
|
||||
parts: array(
|
||||
0: \
|
||||
0: Scalar_EncapsedStringPart(
|
||||
value: \
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: A
|
||||
)
|
||||
@@ -163,11 +174,15 @@ array(
|
||||
)
|
||||
14: Scalar_Encapsed(
|
||||
parts: array(
|
||||
0: \{
|
||||
0: Scalar_EncapsedStringPart(
|
||||
value: \{
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: A
|
||||
)
|
||||
2: }
|
||||
2: Scalar_EncapsedStringPart(
|
||||
value: }
|
||||
)
|
||||
)
|
||||
)
|
||||
15: Scalar_Encapsed(
|
||||
@@ -177,12 +192,16 @@ array(
|
||||
name: A
|
||||
)
|
||||
)
|
||||
1: [B]
|
||||
1: Scalar_EncapsedStringPart(
|
||||
value: [B]
|
||||
)
|
||||
)
|
||||
)
|
||||
16: Scalar_Encapsed(
|
||||
parts: array(
|
||||
0: $
|
||||
0: Scalar_EncapsedStringPart(
|
||||
value: $
|
||||
)
|
||||
1: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: A
|
||||
@@ -195,11 +214,15 @@ array(
|
||||
)
|
||||
17: Scalar_Encapsed(
|
||||
parts: array(
|
||||
0: A
|
||||
0: Scalar_EncapsedStringPart(
|
||||
value: A
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: B
|
||||
)
|
||||
2: C
|
||||
2: Scalar_EncapsedStringPart(
|
||||
value: C
|
||||
)
|
||||
)
|
||||
)
|
||||
18: Scalar_Encapsed(
|
||||
@@ -209,4 +232,11 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
19: Scalar_Encapsed(
|
||||
parts: array(
|
||||
0: Expr_Variable(
|
||||
name: A
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -53,18 +53,22 @@ array(
|
||||
value: INF
|
||||
)
|
||||
10: Scalar_DNumber(
|
||||
value: @@{ 0xFFFFFFFFFFFFFFFF }@@
|
||||
value: 1.844674407371E+19
|
||||
comments: array(
|
||||
0: // various integer -> float overflows
|
||||
1: // (all are actually the same number, just in different representations)
|
||||
)
|
||||
)
|
||||
11: Scalar_DNumber(
|
||||
value: @@{ 0xFFFFFFFFFFFFFFFF }@@
|
||||
value: 1.844674407371E+19
|
||||
)
|
||||
12: Scalar_DNumber(
|
||||
value: @@{ 0xFFFFFFFFFFFFFFFF }@@
|
||||
value: 1.844674407371E+19
|
||||
)
|
||||
13: Scalar_DNumber(
|
||||
value: @@{ 0xFFFFFFFFFFFFFFFF }@@
|
||||
value: 1.844674407371E+19
|
||||
)
|
||||
14: Scalar_DNumber(
|
||||
value: @@{ 0xFFFFFFFFFFFFFFFF }@@
|
||||
value: 1.844674407371E+19
|
||||
)
|
||||
)
|
@@ -10,7 +10,6 @@ Different integer syntaxes
|
||||
0xfff;
|
||||
0XfFf;
|
||||
0777;
|
||||
0787;
|
||||
0b111000111000;
|
||||
-----
|
||||
array(
|
||||
@@ -39,9 +38,6 @@ array(
|
||||
value: 511
|
||||
)
|
||||
8: Scalar_LNumber(
|
||||
value: 7
|
||||
)
|
||||
9: Scalar_LNumber(
|
||||
value: 3640
|
||||
)
|
||||
)
|
17
vendor/nikic/php-parser/test/code/parser/scalar/invalidOctal.test
vendored
Normal file
17
vendor/nikic/php-parser/test/code/parser/scalar/invalidOctal.test
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
Invalid octal literals
|
||||
-----
|
||||
<?php
|
||||
0787;
|
||||
-----
|
||||
!!php7
|
||||
Invalid numeric literal from 2:1 to 2:4
|
||||
-----
|
||||
<?php
|
||||
0787;
|
||||
-----
|
||||
!!php5
|
||||
array(
|
||||
0: Scalar_LNumber(
|
||||
value: 7
|
||||
)
|
||||
)
|
20
vendor/nikic/php-parser/test/code/parser/scalar/unicodeEscape.test
vendored
Normal file
20
vendor/nikic/php-parser/test/code/parser/scalar/unicodeEscape.test
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Unicode escape sequence
|
||||
-----
|
||||
<?php
|
||||
|
||||
"\u{0}";
|
||||
"\u{114}";
|
||||
"\u{1F602}";
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Scalar_String(
|
||||
value: @@{"\0"}@@
|
||||
)
|
||||
1: Scalar_String(
|
||||
value: Ĕ
|
||||
)
|
||||
2: Scalar_String(
|
||||
value: @@{"\xF0\x9F\x98\x82"}@@
|
||||
)
|
||||
)
|
380
vendor/nikic/php-parser/test/code/parser/semiReserved.test
vendored
Normal file
380
vendor/nikic/php-parser/test/code/parser/semiReserved.test
vendored
Normal file
@@ -0,0 +1,380 @@
|
||||
Valid usages of reserved keywords as identifiers
|
||||
-----
|
||||
<?php
|
||||
|
||||
class Test {
|
||||
function array() {}
|
||||
function public() {}
|
||||
|
||||
static function list() {}
|
||||
static function protected() {}
|
||||
|
||||
public $class;
|
||||
public $private;
|
||||
|
||||
const TRAIT = 3, FINAL = 4;
|
||||
|
||||
const __CLASS__ = 1, __TRAIT__ = 2, __FUNCTION__ = 3, __METHOD__ = 4, __LINE__ = 5,
|
||||
__FILE__ = 6, __DIR__ = 7, __NAMESPACE__ = 8;
|
||||
// __halt_compiler does not work
|
||||
}
|
||||
|
||||
$t = new Test;
|
||||
$t->array();
|
||||
$t->public();
|
||||
|
||||
Test::list();
|
||||
Test::protected();
|
||||
|
||||
$t->class;
|
||||
$t->private;
|
||||
|
||||
Test::TRAIT;
|
||||
Test::FINAL;
|
||||
|
||||
class Foo {
|
||||
use TraitA, TraitB {
|
||||
TraitA::catch insteadof namespace\TraitB;
|
||||
TraitA::list as foreach;
|
||||
TraitB::throw as protected public;
|
||||
TraitB::self as protected;
|
||||
exit as die;
|
||||
\TraitC::exit as bye;
|
||||
namespace\TraitC::exit as byebye;
|
||||
TraitA::
|
||||
//
|
||||
/** doc comment */
|
||||
#
|
||||
catch /* comment */
|
||||
// comment
|
||||
# comment
|
||||
insteadof TraitB;
|
||||
}
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
type: 0
|
||||
name: Test
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
type: 0
|
||||
byRef: false
|
||||
name: array
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_ClassMethod(
|
||||
type: 0
|
||||
byRef: false
|
||||
name: public
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
2: Stmt_ClassMethod(
|
||||
type: 8
|
||||
byRef: false
|
||||
name: list
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
3: Stmt_ClassMethod(
|
||||
type: 8
|
||||
byRef: false
|
||||
name: protected
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
4: Stmt_Property(
|
||||
type: 1
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: class
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Stmt_Property(
|
||||
type: 1
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: private
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
6: Stmt_ClassConst(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: TRAIT
|
||||
value: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
)
|
||||
1: Const(
|
||||
name: FINAL
|
||||
value: Scalar_LNumber(
|
||||
value: 4
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
7: Stmt_ClassConst(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: __CLASS__
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
1: Const(
|
||||
name: __TRAIT__
|
||||
value: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
2: Const(
|
||||
name: __FUNCTION__
|
||||
value: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
)
|
||||
3: Const(
|
||||
name: __METHOD__
|
||||
value: Scalar_LNumber(
|
||||
value: 4
|
||||
)
|
||||
)
|
||||
4: Const(
|
||||
name: __LINE__
|
||||
value: Scalar_LNumber(
|
||||
value: 5
|
||||
)
|
||||
)
|
||||
5: Const(
|
||||
name: __FILE__
|
||||
value: Scalar_LNumber(
|
||||
value: 6
|
||||
)
|
||||
)
|
||||
6: Const(
|
||||
name: __DIR__
|
||||
value: Scalar_LNumber(
|
||||
value: 7
|
||||
)
|
||||
)
|
||||
7: Const(
|
||||
name: __NAMESPACE__
|
||||
value: Scalar_LNumber(
|
||||
value: 8
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
name: t
|
||||
)
|
||||
expr: Expr_New(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: Test
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Expr_MethodCall(
|
||||
var: Expr_Variable(
|
||||
name: t
|
||||
)
|
||||
name: array
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
3: Expr_MethodCall(
|
||||
var: Expr_Variable(
|
||||
name: t
|
||||
)
|
||||
name: public
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
4: Expr_StaticCall(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: Test
|
||||
)
|
||||
)
|
||||
name: list
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
5: Expr_StaticCall(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: Test
|
||||
)
|
||||
)
|
||||
name: protected
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
6: Expr_PropertyFetch(
|
||||
var: Expr_Variable(
|
||||
name: t
|
||||
)
|
||||
name: class
|
||||
)
|
||||
7: Expr_PropertyFetch(
|
||||
var: Expr_Variable(
|
||||
name: t
|
||||
)
|
||||
name: private
|
||||
)
|
||||
8: Expr_ClassConstFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: Test
|
||||
)
|
||||
)
|
||||
name: TRAIT
|
||||
)
|
||||
9: Expr_ClassConstFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: Test
|
||||
)
|
||||
)
|
||||
name: FINAL
|
||||
)
|
||||
10: Stmt_Class(
|
||||
type: 0
|
||||
name: Foo
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_TraitUse(
|
||||
traits: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: TraitA
|
||||
)
|
||||
)
|
||||
1: Name(
|
||||
parts: array(
|
||||
0: TraitB
|
||||
)
|
||||
)
|
||||
)
|
||||
adaptations: array(
|
||||
0: Stmt_TraitUseAdaptation_Precedence(
|
||||
trait: Name(
|
||||
parts: array(
|
||||
0: TraitA
|
||||
)
|
||||
)
|
||||
method: catch
|
||||
insteadof: array(
|
||||
0: Name_Relative(
|
||||
parts: array(
|
||||
0: TraitB
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: Name(
|
||||
parts: array(
|
||||
0: TraitA
|
||||
)
|
||||
)
|
||||
method: list
|
||||
newModifier: null
|
||||
newName: foreach
|
||||
)
|
||||
2: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: Name(
|
||||
parts: array(
|
||||
0: TraitB
|
||||
)
|
||||
)
|
||||
method: throw
|
||||
newModifier: 2
|
||||
newName: public
|
||||
)
|
||||
3: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: Name(
|
||||
parts: array(
|
||||
0: TraitB
|
||||
)
|
||||
)
|
||||
method: self
|
||||
newModifier: 2
|
||||
newName: null
|
||||
)
|
||||
4: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: null
|
||||
method: exit
|
||||
newModifier: null
|
||||
newName: die
|
||||
)
|
||||
5: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: Name_FullyQualified(
|
||||
parts: array(
|
||||
0: TraitC
|
||||
)
|
||||
)
|
||||
method: exit
|
||||
newModifier: null
|
||||
newName: bye
|
||||
)
|
||||
6: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: Name_Relative(
|
||||
parts: array(
|
||||
0: TraitC
|
||||
)
|
||||
)
|
||||
method: exit
|
||||
newModifier: null
|
||||
newName: byebye
|
||||
)
|
||||
7: Stmt_TraitUseAdaptation_Precedence(
|
||||
trait: Name(
|
||||
parts: array(
|
||||
0: TraitA
|
||||
)
|
||||
)
|
||||
method: catch
|
||||
insteadof: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: TraitB
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -38,6 +38,11 @@ array(
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_Nop(
|
||||
comments: array(
|
||||
0: // Type in the partial parse could conceivably be any of 0, 16 or 32
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { abstract $a; }
|
||||
|
@@ -2,6 +2,8 @@ Declare
|
||||
-----
|
||||
<?php
|
||||
|
||||
declare (X='Y');
|
||||
|
||||
declare (A='B', C='D') {}
|
||||
|
||||
declare (A='B', C='D'):
|
||||
@@ -11,20 +13,13 @@ array(
|
||||
0: Stmt_Declare(
|
||||
declares: array(
|
||||
0: Stmt_DeclareDeclare(
|
||||
key: A
|
||||
key: X
|
||||
value: Scalar_String(
|
||||
value: B
|
||||
)
|
||||
)
|
||||
1: Stmt_DeclareDeclare(
|
||||
key: C
|
||||
value: Scalar_String(
|
||||
value: D
|
||||
value: Y
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
stmts: null
|
||||
)
|
||||
1: Stmt_Declare(
|
||||
declares: array(
|
||||
@@ -44,4 +39,22 @@ array(
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
2: Stmt_Declare(
|
||||
declares: array(
|
||||
0: Stmt_DeclareDeclare(
|
||||
key: A
|
||||
value: Scalar_String(
|
||||
value: B
|
||||
)
|
||||
)
|
||||
1: Stmt_DeclareDeclare(
|
||||
key: C
|
||||
value: Scalar_String(
|
||||
value: D
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
45
vendor/nikic/php-parser/test/code/parser/stmt/function/scalarTypeDeclarations.test
vendored
Normal file
45
vendor/nikic/php-parser/test/code/parser/stmt/function/scalarTypeDeclarations.test
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
Scalar type declarations
|
||||
-----
|
||||
<?php
|
||||
function test(bool $a, Int $b, FLOAT $c, StRiNg $d) {}
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: test
|
||||
params: array(
|
||||
0: Param(
|
||||
type: bool
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: a
|
||||
default: null
|
||||
)
|
||||
1: Param(
|
||||
type: int
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: b
|
||||
default: null
|
||||
)
|
||||
2: Param(
|
||||
type: float
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: c
|
||||
default: null
|
||||
)
|
||||
3: Param(
|
||||
type: string
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: d
|
||||
default: null
|
||||
)
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
@@ -42,6 +42,9 @@ array(
|
||||
0: Expr_Yield(
|
||||
key: null
|
||||
value: null
|
||||
comments: array(
|
||||
0: // statements
|
||||
)
|
||||
)
|
||||
1: Expr_Yield(
|
||||
key: null
|
||||
@@ -60,11 +63,17 @@ array(
|
||||
3: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
name: data
|
||||
comments: array(
|
||||
0: // expressions
|
||||
)
|
||||
)
|
||||
expr: Expr_Yield(
|
||||
key: null
|
||||
value: null
|
||||
)
|
||||
comments: array(
|
||||
0: // expressions
|
||||
)
|
||||
)
|
||||
4: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
@@ -112,6 +121,9 @@ array(
|
||||
)
|
||||
)
|
||||
else: null
|
||||
comments: array(
|
||||
0: // yield in language constructs with their own parentheses
|
||||
)
|
||||
)
|
||||
7: Stmt_If(
|
||||
cond: Expr_Yield(
|
||||
@@ -179,6 +191,9 @@ array(
|
||||
parts: array(
|
||||
0: func
|
||||
)
|
||||
comments: array(
|
||||
0: // yield in function calls
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
@@ -192,6 +207,9 @@ array(
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // yield in function calls
|
||||
)
|
||||
)
|
||||
13: Expr_MethodCall(
|
||||
var: Expr_Variable(
|
||||
@@ -259,4 +277,4 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
230
vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldPrecedence.test
vendored
Normal file
230
vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldPrecedence.test
vendored
Normal file
@@ -0,0 +1,230 @@
|
||||
Yield operator precedence
|
||||
-----
|
||||
<?php
|
||||
|
||||
function gen() {
|
||||
yield "a" . "b";
|
||||
yield "a" or die;
|
||||
yield "k" => "a" . "b";
|
||||
yield "k" => "a" or die;
|
||||
var_dump([yield "k" => "a" . "b"]);
|
||||
yield yield "k1" => yield "k2" => "a" . "b";
|
||||
yield yield "k1" => (yield "k2") => "a" . "b";
|
||||
var_dump([yield "k1" => yield "k2" => "a" . "b"]);
|
||||
var_dump([yield "k1" => (yield "k2") => "a" . "b"]);
|
||||
}
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: gen
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
0: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Expr_BinaryOp_LogicalOr(
|
||||
left: Expr_Yield(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
)
|
||||
right: Expr_Exit(
|
||||
expr: null
|
||||
)
|
||||
)
|
||||
2: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k
|
||||
)
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Expr_BinaryOp_LogicalOr(
|
||||
left: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
)
|
||||
right: Expr_Exit(
|
||||
expr: null
|
||||
)
|
||||
)
|
||||
4: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: var_dump
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k
|
||||
)
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k1
|
||||
)
|
||||
value: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k2
|
||||
)
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
6: Expr_Yield(
|
||||
key: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k1
|
||||
)
|
||||
value: Expr_Yield(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: k2
|
||||
)
|
||||
)
|
||||
)
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
||||
7: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: var_dump
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k1
|
||||
)
|
||||
value: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k2
|
||||
)
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
8: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: var_dump
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k1
|
||||
)
|
||||
value: Expr_Yield(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: k2
|
||||
)
|
||||
)
|
||||
)
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
48
vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldUnaryPrecedence.test
vendored
Normal file
48
vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldUnaryPrecedence.test
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
Yield with unary operator argument
|
||||
-----
|
||||
<?php
|
||||
|
||||
function gen() {
|
||||
yield +1;
|
||||
yield -1;
|
||||
yield * -1;
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: gen
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
0: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_UnaryPlus(
|
||||
expr: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_UnaryMinus(
|
||||
expr: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Expr_BinaryOp_Mul(
|
||||
left: Expr_Yield(
|
||||
key: null
|
||||
value: null
|
||||
)
|
||||
right: Expr_UnaryMinus(
|
||||
expr: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -81,6 +81,9 @@ array(
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // without else
|
||||
)
|
||||
)
|
||||
3: Stmt_If(
|
||||
cond: Expr_Variable(
|
||||
@@ -92,4 +95,9 @@ array(
|
||||
)
|
||||
else: null
|
||||
)
|
||||
4: Stmt_Nop(
|
||||
comments: array(
|
||||
0: // without else
|
||||
)
|
||||
)
|
||||
)
|
@@ -6,7 +6,7 @@ For loop
|
||||
for ($i = 0; $i < $c; ++$i) {}
|
||||
|
||||
// multiple expressions
|
||||
for (;$a,$b;) {}
|
||||
for ($a, $b; $c, $d; $e, $f) {}
|
||||
|
||||
// infinite loop
|
||||
for (;;) {}
|
||||
@@ -46,11 +46,12 @@ array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // "classical" loop
|
||||
)
|
||||
)
|
||||
1: Stmt_For(
|
||||
init: array(
|
||||
)
|
||||
cond: array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
@@ -58,10 +59,27 @@ array(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
cond: array(
|
||||
0: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: d
|
||||
)
|
||||
)
|
||||
loop: array(
|
||||
0: Expr_Variable(
|
||||
name: e
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: f
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // multiple expressions
|
||||
)
|
||||
)
|
||||
2: Stmt_For(
|
||||
init: array(
|
||||
@@ -72,6 +90,9 @@ array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // infinite loop
|
||||
)
|
||||
)
|
||||
3: Stmt_For(
|
||||
init: array(
|
||||
@@ -82,5 +103,8 @@ array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // alternative syntax
|
||||
)
|
||||
)
|
||||
)
|
@@ -29,6 +29,9 @@ array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // foreach on variable
|
||||
)
|
||||
)
|
||||
1: Stmt_Foreach(
|
||||
expr: Expr_Variable(
|
||||
@@ -123,6 +126,9 @@ array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // foreach on expression
|
||||
)
|
||||
)
|
||||
7: Stmt_Foreach(
|
||||
expr: Expr_Variable(
|
||||
@@ -135,5 +141,8 @@ array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // alternative syntax
|
||||
)
|
||||
)
|
||||
)
|
@@ -21,6 +21,7 @@ array(
|
||||
type: 1
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
@@ -35,6 +36,7 @@ array(
|
||||
type: 1
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
@@ -49,6 +51,7 @@ array(
|
||||
type: 1
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: F
|
||||
@@ -58,6 +61,7 @@ array(
|
||||
alias: H
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: 0
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: J
|
||||
@@ -71,6 +75,7 @@ array(
|
||||
type: 1
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
@@ -79,11 +84,15 @@ array(
|
||||
alias: A
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // evil alias notation - Do Not Use!
|
||||
)
|
||||
)
|
||||
4: Stmt_Use(
|
||||
type: 1
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
@@ -97,6 +106,7 @@ array(
|
||||
type: 2
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
@@ -106,11 +116,15 @@ array(
|
||||
alias: bar
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // function and constant aliases
|
||||
)
|
||||
)
|
||||
6: Stmt_Use(
|
||||
type: 2
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
@@ -125,6 +139,7 @@ array(
|
||||
type: 3
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
@@ -139,6 +154,7 @@ array(
|
||||
type: 3
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
|
188
vendor/nikic/php-parser/test/code/parser/stmt/namespace/groupUse.test
vendored
Normal file
188
vendor/nikic/php-parser/test/code/parser/stmt/namespace/groupUse.test
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
Group use declarations
|
||||
-----
|
||||
<?php
|
||||
use A\{B};
|
||||
use A\{B\C, D};
|
||||
use \A\B\{C\D, E};
|
||||
use function A\{b\c, d};
|
||||
use const \A\{B\C, D};
|
||||
use A\B\{C\D, function b\c, const D};
|
||||
-----
|
||||
array(
|
||||
0: Stmt_GroupUse(
|
||||
type: 0
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 1
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
alias: B
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_GroupUse(
|
||||
type: 0
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 1
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
1: C
|
||||
)
|
||||
)
|
||||
alias: C
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: 1
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: D
|
||||
)
|
||||
)
|
||||
alias: D
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_GroupUse(
|
||||
type: 0
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 1
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
1: D
|
||||
)
|
||||
)
|
||||
alias: D
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: 1
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
alias: E
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Stmt_GroupUse(
|
||||
type: 2
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: b
|
||||
1: c
|
||||
)
|
||||
)
|
||||
alias: c
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: 0
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: d
|
||||
)
|
||||
)
|
||||
alias: d
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Stmt_GroupUse(
|
||||
type: 3
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
1: C
|
||||
)
|
||||
)
|
||||
alias: C
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: 0
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: D
|
||||
)
|
||||
)
|
||||
alias: D
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Stmt_GroupUse(
|
||||
type: 0
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 1
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
1: D
|
||||
)
|
||||
)
|
||||
alias: D
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: 2
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: b
|
||||
1: c
|
||||
)
|
||||
)
|
||||
alias: c
|
||||
)
|
||||
2: Stmt_UseUse(
|
||||
type: 3
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: D
|
||||
)
|
||||
)
|
||||
alias: D
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
45
vendor/nikic/php-parser/test/code/parser/stmt/namespace/groupUseErrors.test
vendored
Normal file
45
vendor/nikic/php-parser/test/code/parser/stmt/namespace/groupUseErrors.test
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
Invalid group use syntax
|
||||
-----
|
||||
<?php
|
||||
// Missing semicolon
|
||||
use Foo\{Bar}
|
||||
use Bar\{Foo};
|
||||
-----
|
||||
Syntax error, unexpected T_USE, expecting ';' from 4:1 to 4:3
|
||||
array(
|
||||
0: Stmt_GroupUse(
|
||||
type: 0
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: Bar
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 1
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
alias: Foo
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
// Missing NS separator
|
||||
use Foo {Bar, Baz};
|
||||
-----
|
||||
Syntax error, unexpected '{', expecting ',' or ';' from 3:9 to 3:9
|
||||
array(
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
// Extra NS separator
|
||||
use Foo\{\Bar};
|
||||
-----
|
||||
Syntax error, unexpected T_NS_SEPARATOR, expecting T_STRING or T_FUNCTION or T_CONST from 3:10 to 3:10
|
||||
array(
|
||||
)
|
22
vendor/nikic/php-parser/test/code/parser/stmt/namespace/nsAfterHashbang.test
vendored
Normal file
22
vendor/nikic/php-parser/test/code/parser/stmt/namespace/nsAfterHashbang.test
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Hashbang followed by namespace declaration
|
||||
-----
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
namespace A;
|
||||
-----
|
||||
array(
|
||||
0: Stmt_InlineHTML(
|
||||
value: #!/usr/bin/env php
|
||||
|
||||
)
|
||||
1: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
@@ -19,8 +19,7 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
stmts: null
|
||||
)
|
||||
1: Stmt_Namespace(
|
||||
name: Name(
|
||||
@@ -34,4 +33,26 @@ array(
|
||||
2: Stmt_HaltCompiler(
|
||||
remaining: Hi!
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
/* Comment */
|
||||
;
|
||||
namespace Foo;
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Nop(
|
||||
comments: array(
|
||||
0: /* Comment */
|
||||
)
|
||||
)
|
||||
1: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
@@ -49,6 +49,9 @@ array(
|
||||
)
|
||||
cases: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // alternative syntax
|
||||
)
|
||||
)
|
||||
2: Stmt_Switch(
|
||||
cond: Expr_Variable(
|
||||
@@ -56,6 +59,9 @@ array(
|
||||
)
|
||||
cases: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // leading semicolon
|
||||
)
|
||||
)
|
||||
3: Stmt_Switch(
|
||||
cond: Expr_Variable(
|
||||
|
@@ -102,6 +102,9 @@ array(
|
||||
)
|
||||
)
|
||||
finallyStmts: null
|
||||
comments: array(
|
||||
0: // no finally
|
||||
)
|
||||
)
|
||||
2: Stmt_TryCatch(
|
||||
stmts: array(
|
||||
@@ -110,5 +113,8 @@ array(
|
||||
)
|
||||
finallyStmts: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // no catch
|
||||
)
|
||||
)
|
||||
)
|
Reference in New Issue
Block a user