First commit
This commit is contained in:
commit
c6e2478c40
13918 changed files with 2303184 additions and 0 deletions
142
vendor/nikic/php-parser/test/code/parser/expr/arrayDef.test
vendored
Normal file
142
vendor/nikic/php-parser/test/code/parser/expr/arrayDef.test
vendored
Normal file
|
@ -0,0 +1,142 @@
|
|||
Array definitions
|
||||
-----
|
||||
<?php
|
||||
|
||||
array();
|
||||
array('a');
|
||||
array('a', );
|
||||
array('a', 'b');
|
||||
array('a', &$b, 'c' => 'd', 'e' => &$f);
|
||||
|
||||
// short array syntax
|
||||
[];
|
||||
[1, 2, 3];
|
||||
['a' => 'b'];
|
||||
-----
|
||||
array(
|
||||
0: Expr_Array(
|
||||
items: array(
|
||||
)
|
||||
)
|
||||
1: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: true
|
||||
)
|
||||
2: Expr_ArrayItem(
|
||||
key: Scalar_String(
|
||||
value: c
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: d
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
3: Expr_ArrayItem(
|
||||
key: Scalar_String(
|
||||
value: e
|
||||
)
|
||||
value: Expr_Variable(
|
||||
name: f
|
||||
)
|
||||
byRef: true
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Expr_Array(
|
||||
items: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // short array syntax
|
||||
)
|
||||
)
|
||||
6: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
2: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
7: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
144
vendor/nikic/php-parser/test/code/parser/expr/arrayDestructuring.test
vendored
Normal file
144
vendor/nikic/php-parser/test/code/parser/expr/arrayDestructuring.test
vendored
Normal file
|
@ -0,0 +1,144 @@
|
|||
Array destructuring
|
||||
-----
|
||||
<?php
|
||||
|
||||
[$a, $b] = [$c, $d];
|
||||
[, $a, , , $b, ,] = $foo;
|
||||
[, [[$a]], $b] = $bar;
|
||||
['a' => $b, 'b' => $a] = $baz;
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Expr_Assign(
|
||||
var: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
expr: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: d
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Expr_Assign(
|
||||
var: Expr_Array(
|
||||
items: array(
|
||||
0: null
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
2: null
|
||||
3: null
|
||||
4: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
5: null
|
||||
)
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
2: Expr_Assign(
|
||||
var: Expr_Array(
|
||||
items: array(
|
||||
0: null
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
2: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: bar
|
||||
)
|
||||
)
|
||||
3: Expr_Assign(
|
||||
var: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: baz
|
||||
)
|
||||
)
|
||||
)
|
301
vendor/nikic/php-parser/test/code/parser/expr/assign.test
vendored
Normal file
301
vendor/nikic/php-parser/test/code/parser/expr/assign.test
vendored
Normal file
|
@ -0,0 +1,301 @@
|
|||
Assignments
|
||||
-----
|
||||
<?php
|
||||
// simple assign
|
||||
$a = $b;
|
||||
|
||||
// combined assign
|
||||
$a &= $b;
|
||||
$a |= $b;
|
||||
$a ^= $b;
|
||||
$a .= $b;
|
||||
$a /= $b;
|
||||
$a -= $b;
|
||||
$a %= $b;
|
||||
$a *= $b;
|
||||
$a += $b;
|
||||
$a <<= $b;
|
||||
$a >>= $b;
|
||||
$a **= $b;
|
||||
|
||||
// chained assign
|
||||
$a = $b *= $c **= $d;
|
||||
|
||||
// by ref assign
|
||||
$a =& $b;
|
||||
|
||||
// list() assign
|
||||
list($a) = $b;
|
||||
list($a, , $b) = $c;
|
||||
list($a, list(, $c), $d) = $e;
|
||||
|
||||
// inc/dec
|
||||
++$a;
|
||||
$a++;
|
||||
--$a;
|
||||
$a--;
|
||||
-----
|
||||
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(
|
||||
name: a
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
3: Expr_AssignOp_BitwiseXor(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
4: Expr_AssignOp_Concat(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
5: Expr_AssignOp_Div(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
6: Expr_AssignOp_Minus(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
7: Expr_AssignOp_Mod(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
8: Expr_AssignOp_Mul(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
9: Expr_AssignOp_Plus(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
10: Expr_AssignOp_ShiftLeft(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
11: Expr_AssignOp_ShiftRight(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
12: Expr_AssignOp_Pow(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
13: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // chained assign
|
||||
)
|
||||
)
|
||||
expr: Expr_AssignOp_Mul(
|
||||
var: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
expr: Expr_AssignOp_Pow(
|
||||
var: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: d
|
||||
)
|
||||
)
|
||||
)
|
||||
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_Assign(
|
||||
var: Expr_List(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // list() assign
|
||||
)
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
comments: array(
|
||||
0: // list() assign
|
||||
)
|
||||
)
|
||||
16: Expr_Assign(
|
||||
var: Expr_List(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: null
|
||||
2: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
17: Expr_Assign(
|
||||
var: Expr_List(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_List(
|
||||
items: array(
|
||||
0: null
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
2: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: d
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: e
|
||||
)
|
||||
)
|
||||
18: Expr_PreInc(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
comments: array(
|
||||
0: // inc/dec
|
||||
)
|
||||
)
|
||||
19: Expr_PostInc(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
20: Expr_PreDec(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
21: Expr_PostDec(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
)
|
39
vendor/nikic/php-parser/test/code/parser/expr/assignNewByRef.test
vendored
Normal file
39
vendor/nikic/php-parser/test/code/parser/expr/assignNewByRef.test
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
Assigning new by reference (PHP 5 only)
|
||||
-----
|
||||
<?php
|
||||
$a =& new B;
|
||||
-----
|
||||
!!php5
|
||||
array(
|
||||
0: Expr_AssignRef(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
expr: Expr_New(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
$a =& new B;
|
||||
-----
|
||||
!!php7
|
||||
Syntax error, unexpected T_NEW from 2:7 to 2:9
|
||||
array(
|
||||
0: Expr_New(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
72
vendor/nikic/php-parser/test/code/parser/expr/cast.test
vendored
Normal file
72
vendor/nikic/php-parser/test/code/parser/expr/cast.test
vendored
Normal file
|
@ -0,0 +1,72 @@
|
|||
Casts
|
||||
-----
|
||||
<?php
|
||||
(array) $a;
|
||||
(bool) $a;
|
||||
(boolean) $a;
|
||||
(real) $a;
|
||||
(double) $a;
|
||||
(float) $a;
|
||||
(int) $a;
|
||||
(integer) $a;
|
||||
(object) $a;
|
||||
(string) $a;
|
||||
(unset) $a;
|
||||
-----
|
||||
array(
|
||||
0: Expr_Cast_Array(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
1: Expr_Cast_Bool(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
2: Expr_Cast_Bool(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
3: Expr_Cast_Double(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
4: Expr_Cast_Double(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
5: Expr_Cast_Double(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
6: Expr_Cast_Int(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
7: Expr_Cast_Int(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
8: Expr_Cast_Object(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
9: Expr_Cast_String(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
10: Expr_Cast_Unset(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
)
|
13
vendor/nikic/php-parser/test/code/parser/expr/clone.test
vendored
Normal file
13
vendor/nikic/php-parser/test/code/parser/expr/clone.test
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
Clone
|
||||
-----
|
||||
<?php
|
||||
|
||||
clone $a;
|
||||
-----
|
||||
array(
|
||||
0: Expr_Clone(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
)
|
142
vendor/nikic/php-parser/test/code/parser/expr/closure.test
vendored
Normal file
142
vendor/nikic/php-parser/test/code/parser/expr/closure.test
vendored
Normal file
|
@ -0,0 +1,142 @@
|
|||
Closures
|
||||
-----
|
||||
<?php
|
||||
function($a) { $a; };
|
||||
function($a) use($b) {};
|
||||
function() use($a, &$b) {};
|
||||
function &($a) {};
|
||||
static function() {};
|
||||
function($a) : array {};
|
||||
function() use($a) : \Foo\Bar {};
|
||||
-----
|
||||
array(
|
||||
0: Expr_Closure(
|
||||
static: false
|
||||
byRef: false
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: a
|
||||
default: null
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Expr_Closure(
|
||||
static: false
|
||||
byRef: false
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: a
|
||||
default: null
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Expr_ClosureUse(
|
||||
var: b
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
2: Expr_Closure(
|
||||
static: false
|
||||
byRef: false
|
||||
params: array(
|
||||
)
|
||||
uses: array(
|
||||
0: Expr_ClosureUse(
|
||||
var: a
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ClosureUse(
|
||||
var: b
|
||||
byRef: true
|
||||
)
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
3: Expr_Closure(
|
||||
static: false
|
||||
byRef: true
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: a
|
||||
default: null
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
4: Expr_Closure(
|
||||
static: true
|
||||
byRef: false
|
||||
params: array(
|
||||
)
|
||||
uses: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
5: Expr_Closure(
|
||||
static: false
|
||||
byRef: false
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: a
|
||||
default: null
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
)
|
||||
returnType: array
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
6: Expr_Closure(
|
||||
static: false
|
||||
byRef: false
|
||||
params: array(
|
||||
)
|
||||
uses: array(
|
||||
0: Expr_ClosureUse(
|
||||
var: a
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
returnType: Name_FullyQualified(
|
||||
parts: array(
|
||||
0: Foo
|
||||
1: Bar
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
107
vendor/nikic/php-parser/test/code/parser/expr/comparison.test
vendored
Normal file
107
vendor/nikic/php-parser/test/code/parser/expr/comparison.test
vendored
Normal file
|
@ -0,0 +1,107 @@
|
|||
Comparison operators
|
||||
-----
|
||||
<?php
|
||||
$a < $b;
|
||||
$a <= $b;
|
||||
$a > $b;
|
||||
$a >= $b;
|
||||
$a == $b;
|
||||
$a === $b;
|
||||
$a != $b;
|
||||
$a !== $b;
|
||||
$a <=> $b;
|
||||
$a instanceof B;
|
||||
$a instanceof $b;
|
||||
-----
|
||||
array(
|
||||
0: Expr_BinaryOp_Smaller(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
1: Expr_BinaryOp_SmallerOrEqual(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
2: Expr_BinaryOp_Greater(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
3: Expr_BinaryOp_GreaterOrEqual(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
4: Expr_BinaryOp_Equal(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
5: Expr_BinaryOp_Identical(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
6: Expr_BinaryOp_NotEqual(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
7: Expr_BinaryOp_NotIdentical(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
8: Expr_BinaryOp_Spaceship(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
9: Expr_Instanceof(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
)
|
||||
10: Expr_Instanceof(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
class: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
)
|
621
vendor/nikic/php-parser/test/code/parser/expr/constant_expr.test
vendored
Normal file
621
vendor/nikic/php-parser/test/code/parser/expr/constant_expr.test
vendored
Normal file
|
@ -0,0 +1,621 @@
|
|||
Expressions in static scalar context
|
||||
-----
|
||||
<?php
|
||||
|
||||
const T_1 = 1 << 1;
|
||||
const T_2 = 1 / 2;
|
||||
const T_3 = 1.5 + 1.5;
|
||||
const T_4 = "foo" . "bar";
|
||||
const T_5 = (1.5 + 1.5) * 2;
|
||||
const T_6 = "foo" . 2 . 3 . 4.0;
|
||||
const T_7 = __LINE__;
|
||||
const T_8 = <<<ENDOFSTRING
|
||||
This is a test string
|
||||
ENDOFSTRING;
|
||||
const T_9 = ~-1;
|
||||
const T_10 = (-1?:1) + (0?2:3);
|
||||
const T_11 = 1 && 0;
|
||||
const T_12 = 1 and 1;
|
||||
const T_13 = 0 || 0;
|
||||
const T_14 = 1 or 0;
|
||||
const T_15 = 1 xor 1;
|
||||
const T_16 = 1 xor 0;
|
||||
const T_17 = 1 < 0;
|
||||
const T_18 = 0 <= 0;
|
||||
const T_19 = 1 > 0;
|
||||
const T_20 = 1 >= 0;
|
||||
const T_21 = 1 === 1;
|
||||
const T_22 = 1 !== 1;
|
||||
const T_23 = 0 != "0";
|
||||
const T_24 = 1 == "1";
|
||||
const T_25 = 1 + 2 * 3;
|
||||
const T_26 = "1" + 2 + "3";
|
||||
const T_27 = 2 ** 3;
|
||||
const T_28 = [1, 2, 3][1];
|
||||
const T_29 = 12 - 13;
|
||||
const T_30 = 12 ^ 13;
|
||||
const T_31 = 12 & 13;
|
||||
const T_32 = 12 | 13;
|
||||
const T_33 = 12 % 3;
|
||||
const T_34 = 100 >> 4;
|
||||
const T_35 = !false;
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_1
|
||||
value: Expr_BinaryOp_ShiftLeft(
|
||||
left: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_2
|
||||
value: Expr_BinaryOp_Div(
|
||||
left: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_3
|
||||
value: Expr_BinaryOp_Plus(
|
||||
left: Scalar_DNumber(
|
||||
value: 1.5
|
||||
)
|
||||
right: Scalar_DNumber(
|
||||
value: 1.5
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_4
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: foo
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: bar
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_5
|
||||
value: Expr_BinaryOp_Mul(
|
||||
left: Expr_BinaryOp_Plus(
|
||||
left: Scalar_DNumber(
|
||||
value: 1.5
|
||||
)
|
||||
right: Scalar_DNumber(
|
||||
value: 1.5
|
||||
)
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_6
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Expr_BinaryOp_Concat(
|
||||
left: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: foo
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
)
|
||||
right: Scalar_DNumber(
|
||||
value: 4
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
6: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_7
|
||||
value: Scalar_MagicConst_Line(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
7: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_8
|
||||
value: Scalar_String(
|
||||
value: This is a test string
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
8: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_9
|
||||
value: Expr_BitwiseNot(
|
||||
expr: Expr_UnaryMinus(
|
||||
expr: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
9: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_10
|
||||
value: Expr_BinaryOp_Plus(
|
||||
left: Expr_Ternary(
|
||||
cond: Expr_UnaryMinus(
|
||||
expr: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
if: null
|
||||
else: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
right: Expr_Ternary(
|
||||
cond: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
if: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
else: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
10: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_11
|
||||
value: Expr_BinaryOp_BooleanAnd(
|
||||
left: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
11: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_12
|
||||
value: Expr_BinaryOp_LogicalAnd(
|
||||
left: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
12: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_13
|
||||
value: Expr_BinaryOp_BooleanOr(
|
||||
left: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
13: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_14
|
||||
value: Expr_BinaryOp_LogicalOr(
|
||||
left: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
14: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_15
|
||||
value: Expr_BinaryOp_LogicalXor(
|
||||
left: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
15: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_16
|
||||
value: Expr_BinaryOp_LogicalXor(
|
||||
left: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
16: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_17
|
||||
value: Expr_BinaryOp_Smaller(
|
||||
left: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
17: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_18
|
||||
value: Expr_BinaryOp_SmallerOrEqual(
|
||||
left: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
18: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_19
|
||||
value: Expr_BinaryOp_Greater(
|
||||
left: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
19: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_20
|
||||
value: Expr_BinaryOp_GreaterOrEqual(
|
||||
left: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
20: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_21
|
||||
value: Expr_BinaryOp_Identical(
|
||||
left: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
21: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_22
|
||||
value: Expr_BinaryOp_NotIdentical(
|
||||
left: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
22: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_23
|
||||
value: Expr_BinaryOp_NotEqual(
|
||||
left: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
23: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_24
|
||||
value: Expr_BinaryOp_Equal(
|
||||
left: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
24: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_25
|
||||
value: Expr_BinaryOp_Plus(
|
||||
left: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
right: Expr_BinaryOp_Mul(
|
||||
left: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
25: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_26
|
||||
value: Expr_BinaryOp_Plus(
|
||||
left: Expr_BinaryOp_Plus(
|
||||
left: Scalar_String(
|
||||
value: 1
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: 3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
26: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_27
|
||||
value: Expr_BinaryOp_Pow(
|
||||
left: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
27: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_28
|
||||
value: Expr_ArrayDimFetch(
|
||||
var: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
2: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
28: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_29
|
||||
value: Expr_BinaryOp_Minus(
|
||||
left: Scalar_LNumber(
|
||||
value: 12
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 13
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
29: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_30
|
||||
value: Expr_BinaryOp_BitwiseXor(
|
||||
left: Scalar_LNumber(
|
||||
value: 12
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 13
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
30: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_31
|
||||
value: Expr_BinaryOp_BitwiseAnd(
|
||||
left: Scalar_LNumber(
|
||||
value: 12
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 13
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
31: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_32
|
||||
value: Expr_BinaryOp_BitwiseOr(
|
||||
left: Scalar_LNumber(
|
||||
value: 12
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 13
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
32: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_33
|
||||
value: Expr_BinaryOp_Mod(
|
||||
left: Scalar_LNumber(
|
||||
value: 12
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
33: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_34
|
||||
value: Expr_BinaryOp_ShiftRight(
|
||||
left: Scalar_LNumber(
|
||||
value: 100
|
||||
)
|
||||
right: Scalar_LNumber(
|
||||
value: 4
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
34: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: T_35
|
||||
value: Expr_BooleanNot(
|
||||
expr: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
12
vendor/nikic/php-parser/test/code/parser/expr/errorSuppress.test
vendored
Normal file
12
vendor/nikic/php-parser/test/code/parser/expr/errorSuppress.test
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
Error suppression
|
||||
-----
|
||||
<?php
|
||||
@$a;
|
||||
-----
|
||||
array(
|
||||
0: Expr_ErrorSuppress(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
)
|
34
vendor/nikic/php-parser/test/code/parser/expr/exit.test
vendored
Normal file
34
vendor/nikic/php-parser/test/code/parser/expr/exit.test
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
Exit
|
||||
-----
|
||||
<?php
|
||||
exit;
|
||||
exit();
|
||||
exit('Die!');
|
||||
die;
|
||||
die();
|
||||
die('Exit!');
|
||||
-----
|
||||
array(
|
||||
0: Expr_Exit(
|
||||
expr: null
|
||||
)
|
||||
1: Expr_Exit(
|
||||
expr: null
|
||||
)
|
||||
2: Expr_Exit(
|
||||
expr: Scalar_String(
|
||||
value: Die!
|
||||
)
|
||||
)
|
||||
3: Expr_Exit(
|
||||
expr: null
|
||||
)
|
||||
4: Expr_Exit(
|
||||
expr: null
|
||||
)
|
||||
5: Expr_Exit(
|
||||
expr: Scalar_String(
|
||||
value: Exit!
|
||||
)
|
||||
)
|
||||
)
|
99
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/args.test
vendored
Normal file
99
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/args.test
vendored
Normal file
|
@ -0,0 +1,99 @@
|
|||
Arguments
|
||||
-----
|
||||
<?php
|
||||
|
||||
f();
|
||||
f($a);
|
||||
f($a, $b);
|
||||
f(&$a);
|
||||
f($a, ...$b);
|
||||
-----
|
||||
array(
|
||||
0: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: f
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
1: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: f
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: f
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
1: Arg(
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: f
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: true
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: f
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
1: Arg(
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
unpack: true
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
33
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constFetch.test
vendored
Normal file
33
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constFetch.test
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
Constant fetches
|
||||
-----
|
||||
<?php
|
||||
|
||||
A;
|
||||
A::B;
|
||||
A::class;
|
||||
-----
|
||||
array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Expr_ClassConstFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: B
|
||||
)
|
||||
2: Expr_ClassConstFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: class
|
||||
)
|
||||
)
|
231
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constantDeref.test
vendored
Normal file
231
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constantDeref.test
vendored
Normal file
|
@ -0,0 +1,231 @@
|
|||
Array/string dereferencing
|
||||
-----
|
||||
<?php
|
||||
|
||||
"abc"[2];
|
||||
"abc"[2][0][0];
|
||||
|
||||
[1, 2, 3][2];
|
||||
[1, 2, 3][2][0][0];
|
||||
|
||||
array(1, 2, 3)[2];
|
||||
array(1, 2, 3)[2][0][0];
|
||||
|
||||
FOO[0];
|
||||
Foo::BAR[1];
|
||||
$foo::BAR[2][1][0];
|
||||
-----
|
||||
array(
|
||||
0: Expr_ArrayDimFetch(
|
||||
var: Scalar_String(
|
||||
value: abc
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
1: Expr_ArrayDimFetch(
|
||||
var: Expr_ArrayDimFetch(
|
||||
var: Expr_ArrayDimFetch(
|
||||
var: Scalar_String(
|
||||
value: abc
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
2: Expr_ArrayDimFetch(
|
||||
var: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
2: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
3: Expr_ArrayDimFetch(
|
||||
var: Expr_ArrayDimFetch(
|
||||
var: Expr_ArrayDimFetch(
|
||||
var: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
2: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
4: Expr_ArrayDimFetch(
|
||||
var: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
2: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
5: Expr_ArrayDimFetch(
|
||||
var: Expr_ArrayDimFetch(
|
||||
var: Expr_ArrayDimFetch(
|
||||
var: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
2: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
6: Expr_ArrayDimFetch(
|
||||
var: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: FOO
|
||||
)
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
7: Expr_ArrayDimFetch(
|
||||
var: Expr_ClassConstFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
name: BAR
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
8: Expr_ArrayDimFetch(
|
||||
var: Expr_ArrayDimFetch(
|
||||
var: Expr_ArrayDimFetch(
|
||||
var: Expr_ClassConstFetch(
|
||||
class: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
name: BAR
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
dim: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
)
|
132
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/funcCall.test
vendored
Normal file
132
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/funcCall.test
vendored
Normal file
|
@ -0,0 +1,132 @@
|
|||
Function calls
|
||||
-----
|
||||
<?php
|
||||
|
||||
// function name variations
|
||||
a();
|
||||
$a();
|
||||
${'a'}();
|
||||
$$a();
|
||||
$$$a();
|
||||
$a['b']();
|
||||
$a{'b'}();
|
||||
$a->b['c']();
|
||||
|
||||
// array dereferencing
|
||||
a()['b'];
|
||||
-----
|
||||
array(
|
||||
0: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: a
|
||||
)
|
||||
comments: array(
|
||||
0: // function name variations
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // function name variations
|
||||
)
|
||||
)
|
||||
1: Expr_FuncCall(
|
||||
name: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
2: Expr_FuncCall(
|
||||
name: Expr_Variable(
|
||||
name: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
3: Expr_FuncCall(
|
||||
name: Expr_Variable(
|
||||
name: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
4: Expr_FuncCall(
|
||||
name: Expr_Variable(
|
||||
name: Expr_Variable(
|
||||
name: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
5: Expr_FuncCall(
|
||||
name: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
6: Expr_FuncCall(
|
||||
name: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
7: Expr_FuncCall(
|
||||
name: Expr_ArrayDimFetch(
|
||||
var: Expr_PropertyFetch(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
name: b
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: c
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
8: Expr_ArrayDimFetch(
|
||||
var: Expr_FuncCall(
|
||||
name: Name(
|
||||
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
|
||||
)
|
||||
)
|
||||
)
|
70
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/newDeref.test
vendored
Normal file
70
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/newDeref.test
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
New expression dereferencing
|
||||
-----
|
||||
<?php
|
||||
|
||||
(new A)->b;
|
||||
(new A)->b();
|
||||
(new A)['b'];
|
||||
(new A)['b']['c'];
|
||||
-----
|
||||
array(
|
||||
0: Expr_PropertyFetch(
|
||||
var: Expr_New(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
name: b
|
||||
)
|
||||
1: Expr_MethodCall(
|
||||
var: Expr_New(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
name: b
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
2: Expr_ArrayDimFetch(
|
||||
var: Expr_New(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
3: Expr_ArrayDimFetch(
|
||||
var: Expr_ArrayDimFetch(
|
||||
var: Expr_New(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: c
|
||||
)
|
||||
)
|
||||
)
|
145
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/objectAccess.test
vendored
Normal file
145
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/objectAccess.test
vendored
Normal file
|
@ -0,0 +1,145 @@
|
|||
Object access
|
||||
-----
|
||||
<?php
|
||||
|
||||
// property fetch variations
|
||||
$a->b;
|
||||
$a->b['c'];
|
||||
$a->b{'c'};
|
||||
|
||||
// method call variations
|
||||
$a->b();
|
||||
$a->{'b'}();
|
||||
$a->$b();
|
||||
$a->$b['c']();
|
||||
|
||||
// array dereferencing
|
||||
$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(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
name: b
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: c
|
||||
)
|
||||
)
|
||||
2: Expr_ArrayDimFetch(
|
||||
var: Expr_PropertyFetch(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
name: b
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: c
|
||||
)
|
||||
)
|
||||
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(
|
||||
name: a
|
||||
)
|
||||
name: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
5: Expr_MethodCall(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
name: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
6: Expr_MethodCall(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
name: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: c
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
7: Expr_ArrayDimFetch(
|
||||
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(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
name: b
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: c
|
||||
)
|
||||
)
|
||||
9: Stmt_Nop(
|
||||
comments: array(
|
||||
0: // invalid PHP: drop Support?
|
||||
)
|
||||
)
|
||||
)
|
62
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/simpleArrayAccess.test
vendored
Normal file
62
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/simpleArrayAccess.test
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
Simple array access
|
||||
-----
|
||||
<?php
|
||||
|
||||
$a['b'];
|
||||
$a['b']['c'];
|
||||
$a[] = $b;
|
||||
$a{'b'};
|
||||
${$a}['b'];
|
||||
-----
|
||||
array(
|
||||
0: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
1: Expr_ArrayDimFetch(
|
||||
var: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: c
|
||||
)
|
||||
)
|
||||
2: Expr_Assign(
|
||||
var: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
dim: null
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
3: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
4: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
173
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticCall.test
vendored
Normal file
173
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticCall.test
vendored
Normal file
|
@ -0,0 +1,173 @@
|
|||
Static calls
|
||||
-----
|
||||
<?php
|
||||
|
||||
// method name variations
|
||||
A::b();
|
||||
A::{'b'}();
|
||||
A::$b();
|
||||
A::$b['c']();
|
||||
A::$b['c']['d']();
|
||||
|
||||
// array dereferencing
|
||||
A::b()['c'];
|
||||
|
||||
// class name variations
|
||||
static::b();
|
||||
$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(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
2: Expr_StaticCall(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
3: Expr_StaticCall(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: c
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
4: Expr_StaticCall(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: Expr_ArrayDimFetch(
|
||||
var: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: c
|
||||
)
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: d
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
5: Expr_ArrayDimFetch(
|
||||
var: Expr_StaticCall(
|
||||
class: Name(
|
||||
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(
|
||||
name: a
|
||||
)
|
||||
name: b
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
8: Expr_StaticCall(
|
||||
class: Expr_Variable(
|
||||
name: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
)
|
||||
name: b
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
9: Expr_StaticCall(
|
||||
class: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
name: c
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
91
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticPropertyFetch.test
vendored
Normal file
91
vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticPropertyFetch.test
vendored
Normal file
|
@ -0,0 +1,91 @@
|
|||
Static property fetches
|
||||
-----
|
||||
<?php
|
||||
|
||||
// property name variations
|
||||
A::$b;
|
||||
A::$$b;
|
||||
A::${'b'};
|
||||
|
||||
// array access
|
||||
A::$b['c'];
|
||||
A::$b{'c'};
|
||||
|
||||
// class name variations can be found in staticCall.test
|
||||
-----
|
||||
array(
|
||||
0: Expr_StaticPropertyFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
comments: array(
|
||||
0: // property name variations
|
||||
)
|
||||
)
|
||||
name: b
|
||||
comments: array(
|
||||
0: // property name variations
|
||||
)
|
||||
)
|
||||
1: Expr_StaticPropertyFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
2: Expr_StaticPropertyFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
3: Expr_ArrayDimFetch(
|
||||
var: Expr_StaticPropertyFetch(
|
||||
class: Name(
|
||||
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(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: b
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: c
|
||||
)
|
||||
)
|
||||
5: Stmt_Nop(
|
||||
comments: array(
|
||||
0: // class name variations can be found in staticCall.test
|
||||
)
|
||||
)
|
||||
)
|
40
vendor/nikic/php-parser/test/code/parser/expr/includeAndEval.test
vendored
Normal file
40
vendor/nikic/php-parser/test/code/parser/expr/includeAndEval.test
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
Include and eval
|
||||
-----
|
||||
<?php
|
||||
include 'A.php';
|
||||
include_once 'A.php';
|
||||
require 'A.php';
|
||||
require_once 'A.php';
|
||||
eval('A');
|
||||
-----
|
||||
array(
|
||||
0: Expr_Include(
|
||||
expr: Scalar_String(
|
||||
value: A.php
|
||||
)
|
||||
type: TYPE_INCLUDE (1)
|
||||
)
|
||||
1: Expr_Include(
|
||||
expr: Scalar_String(
|
||||
value: A.php
|
||||
)
|
||||
type: TYPE_INCLUDE_ONCE (2)
|
||||
)
|
||||
2: Expr_Include(
|
||||
expr: Scalar_String(
|
||||
value: A.php
|
||||
)
|
||||
type: TYPE_REQUIRE (3)
|
||||
)
|
||||
3: Expr_Include(
|
||||
expr: Scalar_String(
|
||||
value: A.php
|
||||
)
|
||||
type: TYPE_REQURE_ONCE (4)
|
||||
)
|
||||
4: Expr_Eval(
|
||||
expr: Scalar_String(
|
||||
value: A
|
||||
)
|
||||
)
|
||||
)
|
75
vendor/nikic/php-parser/test/code/parser/expr/issetAndEmpty.test
vendored
Normal file
75
vendor/nikic/php-parser/test/code/parser/expr/issetAndEmpty.test
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
isset() and empty()
|
||||
-----
|
||||
<?php
|
||||
isset($a);
|
||||
isset($a, $b, $c);
|
||||
|
||||
empty($a);
|
||||
empty(foo());
|
||||
empty(array(1, 2, 3));
|
||||
-----
|
||||
array(
|
||||
0: Expr_Isset(
|
||||
vars: array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Expr_Isset(
|
||||
vars: array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
2: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Expr_Empty(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
3: Expr_Empty(
|
||||
expr: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Expr_Empty(
|
||||
expr: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
2: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
75
vendor/nikic/php-parser/test/code/parser/expr/listWithKeys.test
vendored
Normal file
75
vendor/nikic/php-parser/test/code/parser/expr/listWithKeys.test
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
List destructing with keys
|
||||
-----
|
||||
<?php
|
||||
|
||||
list('a' => $b) = ['a' => 'b'];
|
||||
list('a' => list($b => $c), 'd' => $e) = $x;
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Expr_Assign(
|
||||
var: Expr_List(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
expr: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Expr_Assign(
|
||||
var: Expr_List(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
value: Expr_List(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
value: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: Scalar_String(
|
||||
value: d
|
||||
)
|
||||
value: Expr_Variable(
|
||||
name: e
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: x
|
||||
)
|
||||
)
|
||||
)
|
159
vendor/nikic/php-parser/test/code/parser/expr/logic.test
vendored
Normal file
159
vendor/nikic/php-parser/test/code/parser/expr/logic.test
vendored
Normal file
|
@ -0,0 +1,159 @@
|
|||
Logical operators
|
||||
-----
|
||||
<?php
|
||||
|
||||
// boolean ops
|
||||
$a && $b;
|
||||
$a || $b;
|
||||
!$a;
|
||||
!!$a;
|
||||
|
||||
// logical ops
|
||||
$a and $b;
|
||||
$a or $b;
|
||||
$a xor $b;
|
||||
|
||||
// precedence
|
||||
$a && $b || $c && $d;
|
||||
$a && ($b || $c) && $d;
|
||||
|
||||
$a = $b || $c;
|
||||
$a = $b or $c;
|
||||
-----
|
||||
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(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
2: Expr_BooleanNot(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
3: Expr_BooleanNot(
|
||||
expr: Expr_BooleanNot(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
)
|
||||
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(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
6: Expr_BinaryOp_LogicalXor(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
7: Expr_BinaryOp_BooleanOr(
|
||||
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(
|
||||
name: c
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: d
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // precedence
|
||||
)
|
||||
)
|
||||
8: Expr_BinaryOp_BooleanAnd(
|
||||
left: Expr_BinaryOp_BooleanAnd(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_BinaryOp_BooleanOr(
|
||||
left: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: d
|
||||
)
|
||||
)
|
||||
9: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
expr: Expr_BinaryOp_BooleanOr(
|
||||
left: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
)
|
||||
10: Expr_BinaryOp_LogicalOr(
|
||||
left: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
)
|
256
vendor/nikic/php-parser/test/code/parser/expr/math.test
vendored
Normal file
256
vendor/nikic/php-parser/test/code/parser/expr/math.test
vendored
Normal file
|
@ -0,0 +1,256 @@
|
|||
Mathematical operators
|
||||
-----
|
||||
<?php
|
||||
|
||||
// unary ops
|
||||
~$a;
|
||||
+$a;
|
||||
-$a;
|
||||
|
||||
// binary ops
|
||||
$a & $b;
|
||||
$a | $b;
|
||||
$a ^ $b;
|
||||
$a . $b;
|
||||
$a / $b;
|
||||
$a - $b;
|
||||
$a % $b;
|
||||
$a * $b;
|
||||
$a + $b;
|
||||
$a << $b;
|
||||
$a >> $b;
|
||||
$a ** $b;
|
||||
|
||||
// associativity
|
||||
$a * $b * $c;
|
||||
$a * ($b * $c);
|
||||
|
||||
// precedence
|
||||
$a + $b * $c;
|
||||
($a + $b) * $c;
|
||||
|
||||
// pow is special
|
||||
$a ** $b ** $c;
|
||||
($a ** $b) ** $c;
|
||||
-----
|
||||
array(
|
||||
0: Expr_BitwiseNot(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
comments: array(
|
||||
0: // unary ops
|
||||
)
|
||||
)
|
||||
1: Expr_UnaryPlus(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
2: Expr_UnaryMinus(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
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(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
5: Expr_BinaryOp_BitwiseXor(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
6: Expr_BinaryOp_Concat(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
7: Expr_BinaryOp_Div(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
8: Expr_BinaryOp_Minus(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
9: Expr_BinaryOp_Mod(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
10: Expr_BinaryOp_Mul(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
11: Expr_BinaryOp_Plus(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
12: Expr_BinaryOp_ShiftLeft(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
13: Expr_BinaryOp_ShiftRight(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
14: Expr_BinaryOp_Pow(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
15: Expr_BinaryOp_Mul(
|
||||
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(
|
||||
name: a
|
||||
)
|
||||
right: Expr_BinaryOp_Mul(
|
||||
left: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
)
|
||||
17: Expr_BinaryOp_Plus(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // precedence
|
||||
)
|
||||
)
|
||||
right: Expr_BinaryOp_Mul(
|
||||
left: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // precedence
|
||||
)
|
||||
)
|
||||
18: Expr_BinaryOp_Mul(
|
||||
left: Expr_BinaryOp_Plus(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
19: Expr_BinaryOp_Pow(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // pow is special
|
||||
)
|
||||
)
|
||||
right: Expr_BinaryOp_Pow(
|
||||
left: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // pow is special
|
||||
)
|
||||
)
|
||||
20: Expr_BinaryOp_Pow(
|
||||
left: Expr_BinaryOp_Pow(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
)
|
146
vendor/nikic/php-parser/test/code/parser/expr/new.test
vendored
Normal file
146
vendor/nikic/php-parser/test/code/parser/expr/new.test
vendored
Normal file
|
@ -0,0 +1,146 @@
|
|||
New
|
||||
-----
|
||||
<?php
|
||||
|
||||
new A;
|
||||
new A($b);
|
||||
|
||||
// class name variations
|
||||
new $a();
|
||||
new $a['b']();
|
||||
new A::$b();
|
||||
// DNCR object access
|
||||
new $a->b();
|
||||
new $a->b->c();
|
||||
new $a->b['c']();
|
||||
new $a->b{'c'}();
|
||||
|
||||
// test regression introduces by new dereferencing syntax
|
||||
(new A);
|
||||
-----
|
||||
array(
|
||||
0: Expr_New(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
1: Expr_New(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Expr_New(
|
||||
class: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // class name variations
|
||||
)
|
||||
)
|
||||
3: Expr_New(
|
||||
class: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
4: Expr_New(
|
||||
class: Expr_StaticPropertyFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: b
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
5: Expr_New(
|
||||
class: Expr_PropertyFetch(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
name: b
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // DNCR object access
|
||||
)
|
||||
)
|
||||
6: Expr_New(
|
||||
class: Expr_PropertyFetch(
|
||||
var: Expr_PropertyFetch(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
name: b
|
||||
)
|
||||
name: c
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
7: Expr_New(
|
||||
class: Expr_ArrayDimFetch(
|
||||
var: Expr_PropertyFetch(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
name: b
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: c
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
8: Expr_New(
|
||||
class: Expr_ArrayDimFetch(
|
||||
var: Expr_PropertyFetch(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
name: b
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: c
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
9: Expr_New(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
23
vendor/nikic/php-parser/test/code/parser/expr/newWithoutClass.test
vendored
Normal file
23
vendor/nikic/php-parser/test/code/parser/expr/newWithoutClass.test
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
New without a class
|
||||
-----
|
||||
<?php
|
||||
new;
|
||||
-----
|
||||
!!php5
|
||||
Syntax error, unexpected ';' from 2:4 to 2:4
|
||||
array(
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
new;
|
||||
-----
|
||||
!!php7
|
||||
Syntax error, unexpected ';' from 2:4 to 2:4
|
||||
array(
|
||||
0: Expr_New(
|
||||
class: Expr_Error(
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
12
vendor/nikic/php-parser/test/code/parser/expr/print.test
vendored
Normal file
12
vendor/nikic/php-parser/test/code/parser/expr/print.test
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
Print
|
||||
-----
|
||||
<?php
|
||||
print $a;
|
||||
-----
|
||||
array(
|
||||
0: Expr_Print(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
)
|
46
vendor/nikic/php-parser/test/code/parser/expr/shellExec.test
vendored
Normal file
46
vendor/nikic/php-parser/test/code/parser/expr/shellExec.test
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
Shell execution
|
||||
-----
|
||||
<?php
|
||||
``;
|
||||
`test`;
|
||||
`test $A`;
|
||||
`test \``;
|
||||
`test \"`;
|
||||
-----
|
||||
array(
|
||||
0: Expr_ShellExec(
|
||||
parts: array(
|
||||
)
|
||||
)
|
||||
1: Expr_ShellExec(
|
||||
parts: array(
|
||||
0: Scalar_EncapsedStringPart(
|
||||
value: test
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Expr_ShellExec(
|
||||
parts: array(
|
||||
0: Scalar_EncapsedStringPart(
|
||||
value: test
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: A
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Expr_ShellExec(
|
||||
parts: array(
|
||||
0: Scalar_EncapsedStringPart(
|
||||
value: test `
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Expr_ShellExec(
|
||||
parts: array(
|
||||
0: Scalar_EncapsedStringPart(
|
||||
value: test \"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
149
vendor/nikic/php-parser/test/code/parser/expr/ternaryAndCoalesce.test
vendored
Normal file
149
vendor/nikic/php-parser/test/code/parser/expr/ternaryAndCoalesce.test
vendored
Normal file
|
@ -0,0 +1,149 @@
|
|||
Ternary operator
|
||||
-----
|
||||
<?php
|
||||
|
||||
// ternary
|
||||
$a ? $b : $c;
|
||||
$a ?: $c;
|
||||
|
||||
// precedence
|
||||
$a ? $b : $c ? $d : $e;
|
||||
$a ? $b : ($c ? $d : $e);
|
||||
|
||||
// null coalesce
|
||||
$a ?? $b;
|
||||
$a ?? $b ?? $c;
|
||||
$a ?? $b ? $c : $d;
|
||||
$a && $b ?? $c;
|
||||
-----
|
||||
array(
|
||||
0: Expr_Ternary(
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // ternary
|
||||
)
|
||||
)
|
||||
if: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
else: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
comments: array(
|
||||
0: // ternary
|
||||
)
|
||||
)
|
||||
1: Expr_Ternary(
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
if: null
|
||||
else: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
2: Expr_Ternary(
|
||||
cond: Expr_Ternary(
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
comments: array(
|
||||
0: // precedence
|
||||
)
|
||||
)
|
||||
if: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
else: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
comments: array(
|
||||
0: // precedence
|
||||
)
|
||||
)
|
||||
if: Expr_Variable(
|
||||
name: d
|
||||
)
|
||||
else: Expr_Variable(
|
||||
name: e
|
||||
)
|
||||
comments: array(
|
||||
0: // precedence
|
||||
)
|
||||
)
|
||||
3: Expr_Ternary(
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
if: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
else: Expr_Ternary(
|
||||
cond: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
if: Expr_Variable(
|
||||
name: d
|
||||
)
|
||||
else: Expr_Variable(
|
||||
name: e
|
||||
)
|
||||
)
|
||||
)
|
||||
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(
|
||||
name: a
|
||||
)
|
||||
right: Expr_BinaryOp_Coalesce(
|
||||
left: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
)
|
||||
6: Expr_Ternary(
|
||||
cond: Expr_BinaryOp_Coalesce(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
if: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
else: Expr_Variable(
|
||||
name: d
|
||||
)
|
||||
)
|
||||
7: Expr_BinaryOp_Coalesce(
|
||||
left: Expr_BinaryOp_BooleanAnd(
|
||||
left: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
)
|
25
vendor/nikic/php-parser/test/code/parser/expr/uvs/globalNonSimpleVarError.test
vendored
Normal file
25
vendor/nikic/php-parser/test/code/parser/expr/uvs/globalNonSimpleVarError.test
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
Non-simple variables are forbidden in PHP 7
|
||||
-----
|
||||
<?php
|
||||
global $$foo->bar;
|
||||
-----
|
||||
!!php7
|
||||
Syntax error, unexpected T_OBJECT_OPERATOR, expecting ';' from 2:13 to 2:14
|
||||
array(
|
||||
0: Stmt_Global(
|
||||
vars: array(
|
||||
0: Expr_Variable(
|
||||
name: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: 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
|
||||
)
|
||||
)
|
55
vendor/nikic/php-parser/test/code/parser/expr/variable.test
vendored
Normal file
55
vendor/nikic/php-parser/test/code/parser/expr/variable.test
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
Variable syntaxes
|
||||
-----
|
||||
<?php
|
||||
|
||||
$a;
|
||||
${'a'};
|
||||
${foo()};
|
||||
$$a;
|
||||
$$$a;
|
||||
$$a['b'];
|
||||
-----
|
||||
!!php5
|
||||
array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
)
|
||||
2: Expr_Variable(
|
||||
name: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Expr_Variable(
|
||||
name: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
4: Expr_Variable(
|
||||
name: Expr_Variable(
|
||||
name: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Expr_Variable(
|
||||
name: Expr_ArrayDimFetch(
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
dim: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue