the whole shebang
This commit is contained in:
112
vendor/nikic/php-parser/test/code/parser/stmt/blocklessStatement.test
vendored
Normal file
112
vendor/nikic/php-parser/test/code/parser/stmt/blocklessStatement.test
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
Blockless statements for if/for/etc
|
||||
-----
|
||||
<?php
|
||||
|
||||
if ($a) $A;
|
||||
elseif ($b) $B;
|
||||
else $C;
|
||||
|
||||
for (;;) $foo;
|
||||
|
||||
foreach ($a as $b) $AB;
|
||||
|
||||
while ($a) $A;
|
||||
|
||||
do $A; while ($a);
|
||||
|
||||
declare (a='b') $C;
|
||||
-----
|
||||
array(
|
||||
0: Stmt_If(
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: A
|
||||
)
|
||||
)
|
||||
elseifs: array(
|
||||
0: Stmt_ElseIf(
|
||||
cond: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: B
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
else: Stmt_Else(
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: C
|
||||
)
|
||||
)
|
||||
)
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
1: Stmt_For(
|
||||
init: array(
|
||||
)
|
||||
cond: array(
|
||||
)
|
||||
loop: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_Foreach(
|
||||
keyVar: null
|
||||
byRef: false
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: AB
|
||||
)
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
valueVar: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
3: Stmt_While(
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: A
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Stmt_Do(
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: A
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Stmt_Declare(
|
||||
declares: array(
|
||||
0: Stmt_DeclareDeclare(
|
||||
key: a
|
||||
value: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: C
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
37
vendor/nikic/php-parser/test/code/parser/stmt/class/abstract.test
vendored
Normal file
37
vendor/nikic/php-parser/test/code/parser/stmt/class/abstract.test
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
Abstract class
|
||||
-----
|
||||
<?php
|
||||
|
||||
abstract class A {
|
||||
public function a() {}
|
||||
abstract public function b();
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
type: 16
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
type: 1
|
||||
byRef: false
|
||||
params: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
name: a
|
||||
)
|
||||
1: Stmt_ClassMethod(
|
||||
type: 17
|
||||
byRef: false
|
||||
params: array(
|
||||
)
|
||||
stmts: null
|
||||
name: b
|
||||
)
|
||||
)
|
||||
name: A
|
||||
)
|
||||
)
|
33
vendor/nikic/php-parser/test/code/parser/stmt/class/conditional.test
vendored
Normal file
33
vendor/nikic/php-parser/test/code/parser/stmt/class/conditional.test
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
Conditional class definition
|
||||
-----
|
||||
<?php
|
||||
|
||||
if (true) {
|
||||
class A {}
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_If(
|
||||
stmts: array(
|
||||
0: Stmt_Class(
|
||||
type: 0
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
name: A
|
||||
)
|
||||
)
|
||||
elseifs: array(
|
||||
)
|
||||
else: null
|
||||
cond: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: true
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
17
vendor/nikic/php-parser/test/code/parser/stmt/class/final.test
vendored
Normal file
17
vendor/nikic/php-parser/test/code/parser/stmt/class/final.test
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
Final class
|
||||
-----
|
||||
<?php
|
||||
|
||||
final class A {}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
type: 32
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
name: A
|
||||
)
|
||||
)
|
35
vendor/nikic/php-parser/test/code/parser/stmt/class/interface.test
vendored
Normal file
35
vendor/nikic/php-parser/test/code/parser/stmt/class/interface.test
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
Interface
|
||||
-----
|
||||
<?php
|
||||
|
||||
interface A extends C, D {
|
||||
public function a();
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Interface(
|
||||
extends: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
)
|
||||
)
|
||||
1: Name(
|
||||
parts: array(
|
||||
0: D
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
type: 1
|
||||
byRef: false
|
||||
params: array(
|
||||
)
|
||||
stmts: null
|
||||
name: a
|
||||
)
|
||||
)
|
||||
name: A
|
||||
)
|
||||
)
|
29
vendor/nikic/php-parser/test/code/parser/stmt/class/modifier.test-fail
vendored
Normal file
29
vendor/nikic/php-parser/test/code/parser/stmt/class/modifier.test-fail
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
Invalid modifier combination
|
||||
-----
|
||||
<?php class A { public public $a; }
|
||||
-----
|
||||
Multiple access type modifiers are not allowed on line 1
|
||||
-----
|
||||
<?php class A { public protected $a; }
|
||||
-----
|
||||
Multiple access type modifiers are not allowed on line 1
|
||||
-----
|
||||
<?php class A { abstract abstract a(); }
|
||||
-----
|
||||
Multiple abstract modifiers are not allowed on line 1
|
||||
-----
|
||||
<?php class A { static static $a; }
|
||||
-----
|
||||
Multiple static modifiers are not allowed on line 1
|
||||
-----
|
||||
<?php class A { final final a() {} }
|
||||
-----
|
||||
Multiple final modifiers are not allowed on line 1
|
||||
-----
|
||||
<?php class A { abstract final a(); }
|
||||
-----
|
||||
Cannot use the final and abstract modifier at the same time on line 1
|
||||
-----
|
||||
<?php abstract final class A { }
|
||||
-----
|
||||
Syntax error, unexpected T_FINAL, expecting T_CLASS on line 1
|
61
vendor/nikic/php-parser/test/code/parser/stmt/class/name.test-fail
vendored
Normal file
61
vendor/nikic/php-parser/test/code/parser/stmt/class/name.test-fail
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
Invalid class name
|
||||
-----
|
||||
<?php class self {}
|
||||
-----
|
||||
Cannot use "self" as class name as it is reserved on line 1
|
||||
-----
|
||||
<?php class parent {}
|
||||
-----
|
||||
Cannot use "parent" as class name as it is reserved on line 1
|
||||
-----
|
||||
<?php class static {}
|
||||
-----
|
||||
Syntax error, unexpected T_STATIC, expecting T_STRING on line 1
|
||||
-----
|
||||
<?php class A extends self {}
|
||||
-----
|
||||
Cannot use "self" as class name as it is reserved on line 1
|
||||
-----
|
||||
<?php class A extends parent {}
|
||||
-----
|
||||
Cannot use "parent" as class name as it is reserved on line 1
|
||||
-----
|
||||
<?php class A extends static {}
|
||||
-----
|
||||
Syntax error, unexpected T_STATIC, expecting T_STRING or T_NAMESPACE or T_NS_SEPARATOR on line 1
|
||||
-----
|
||||
<?php class A implements self {}
|
||||
-----
|
||||
Cannot use "self" as interface name as it is reserved on line 1
|
||||
-----
|
||||
<?php class A implements parent {}
|
||||
-----
|
||||
Cannot use "parent" as interface name as it is reserved on line 1
|
||||
-----
|
||||
<?php class A implements static {}
|
||||
-----
|
||||
Syntax error, unexpected T_STATIC, expecting T_STRING or T_NAMESPACE or T_NS_SEPARATOR on line 1
|
||||
-----
|
||||
<?php interface self {}
|
||||
-----
|
||||
Cannot use "self" as interface name as it is reserved on line 1
|
||||
-----
|
||||
<?php interface parent {}
|
||||
-----
|
||||
Cannot use "parent" as interface name as it is reserved on line 1
|
||||
-----
|
||||
<?php interface static {}
|
||||
-----
|
||||
Syntax error, unexpected T_STATIC, expecting T_STRING on line 1
|
||||
-----
|
||||
<?php interface A extends self {}
|
||||
-----
|
||||
Cannot use "self" as interface name as it is reserved on line 1
|
||||
-----
|
||||
<?php interface A extends parent {}
|
||||
-----
|
||||
Cannot use "parent" as interface name as it is reserved on line 1
|
||||
-----
|
||||
<?php interface A extends static {}
|
||||
-----
|
||||
Syntax error, unexpected T_STATIC, expecting T_STRING or T_NAMESPACE or T_NS_SEPARATOR on line 1
|
38
vendor/nikic/php-parser/test/code/parser/stmt/class/php4Style.test
vendored
Normal file
38
vendor/nikic/php-parser/test/code/parser/stmt/class/php4Style.test
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
PHP 4 style declarations
|
||||
-----
|
||||
<?php
|
||||
|
||||
class A {
|
||||
var $foo;
|
||||
function bar() {}
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
type: 0
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
type: 1
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: foo
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_ClassMethod(
|
||||
type: 1
|
||||
byRef: false
|
||||
params: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
name: bar
|
||||
)
|
||||
)
|
||||
name: A
|
||||
)
|
||||
)
|
139
vendor/nikic/php-parser/test/code/parser/stmt/class/simple.test
vendored
Normal file
139
vendor/nikic/php-parser/test/code/parser/stmt/class/simple.test
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
Class declaration
|
||||
-----
|
||||
<?php
|
||||
|
||||
class A extends B implements C, D {
|
||||
const A = 'B', C = 'D';
|
||||
|
||||
public $a = 'b', $c = 'd';
|
||||
protected $e;
|
||||
private $f;
|
||||
|
||||
public function a() {}
|
||||
public static function b() {}
|
||||
public final function c() {}
|
||||
protected function d() {}
|
||||
private function e() {}
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
type: 0
|
||||
extends: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
implements: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
)
|
||||
)
|
||||
1: Name(
|
||||
parts: array(
|
||||
0: D
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassConst(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: A
|
||||
value: Scalar_String(
|
||||
value: B
|
||||
)
|
||||
)
|
||||
1: Const(
|
||||
name: C
|
||||
value: Scalar_String(
|
||||
value: D
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Property(
|
||||
type: 1
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: a
|
||||
default: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
1: Stmt_PropertyProperty(
|
||||
name: c
|
||||
default: Scalar_String(
|
||||
value: d
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_Property(
|
||||
type: 2
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: e
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Stmt_Property(
|
||||
type: 4
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: f
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Stmt_ClassMethod(
|
||||
type: 1
|
||||
byRef: false
|
||||
params: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
name: a
|
||||
)
|
||||
5: Stmt_ClassMethod(
|
||||
type: 9
|
||||
byRef: false
|
||||
params: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
name: b
|
||||
)
|
||||
6: Stmt_ClassMethod(
|
||||
type: 33
|
||||
byRef: false
|
||||
params: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
name: c
|
||||
)
|
||||
7: Stmt_ClassMethod(
|
||||
type: 2
|
||||
byRef: false
|
||||
params: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
name: d
|
||||
)
|
||||
8: Stmt_ClassMethod(
|
||||
type: 4
|
||||
byRef: false
|
||||
params: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
name: e
|
||||
)
|
||||
)
|
||||
name: A
|
||||
)
|
||||
)
|
13
vendor/nikic/php-parser/test/code/parser/stmt/class/staticMethod.test-fail
vendored
Normal file
13
vendor/nikic/php-parser/test/code/parser/stmt/class/staticMethod.test-fail
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
Some special methods cannot be static
|
||||
-----
|
||||
<?php class A { static function __construct() {} }
|
||||
-----
|
||||
"__construct" method cannot be static on line 1
|
||||
-----
|
||||
<?php class A { static function __destruct() {} }
|
||||
-----
|
||||
"__destruct" method cannot be static on line 1
|
||||
-----
|
||||
<?php class A { static function __clone() {} }
|
||||
-----
|
||||
"__clone" method cannot be static on line 1
|
159
vendor/nikic/php-parser/test/code/parser/stmt/class/trait.test
vendored
Normal file
159
vendor/nikic/php-parser/test/code/parser/stmt/class/trait.test
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
Traits
|
||||
-----
|
||||
<?php
|
||||
|
||||
trait A {
|
||||
public function a() {}
|
||||
}
|
||||
|
||||
class B {
|
||||
use C;
|
||||
use D {
|
||||
a as protected b;
|
||||
c as d;
|
||||
e as private;
|
||||
}
|
||||
use E, F, G {
|
||||
E::a insteadof F, G;
|
||||
E::b as protected c;
|
||||
E::d as e;
|
||||
E::f as private;
|
||||
}
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Trait(
|
||||
name: A
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
type: 1
|
||||
byRef: false
|
||||
params: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
name: a
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Class(
|
||||
type: 0
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_TraitUse(
|
||||
traits: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
)
|
||||
)
|
||||
)
|
||||
adaptations: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_TraitUse(
|
||||
traits: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: D
|
||||
)
|
||||
)
|
||||
)
|
||||
adaptations: array(
|
||||
0: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: null
|
||||
method: a
|
||||
newModifier: 2
|
||||
newName: b
|
||||
)
|
||||
1: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: null
|
||||
method: c
|
||||
newModifier: null
|
||||
newName: d
|
||||
)
|
||||
2: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: null
|
||||
method: e
|
||||
newModifier: 4
|
||||
newName: null
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_TraitUse(
|
||||
traits: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
1: Name(
|
||||
parts: array(
|
||||
0: F
|
||||
)
|
||||
)
|
||||
2: Name(
|
||||
parts: array(
|
||||
0: G
|
||||
)
|
||||
)
|
||||
)
|
||||
adaptations: array(
|
||||
0: Stmt_TraitUseAdaptation_Precedence(
|
||||
trait: Name(
|
||||
parts: array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
method: a
|
||||
insteadof: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: F
|
||||
)
|
||||
)
|
||||
1: Name(
|
||||
parts: array(
|
||||
0: G
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: Name(
|
||||
parts: array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
method: b
|
||||
newModifier: 2
|
||||
newName: c
|
||||
)
|
||||
2: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: Name(
|
||||
parts: array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
method: d
|
||||
newModifier: null
|
||||
newName: e
|
||||
)
|
||||
3: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: Name(
|
||||
parts: array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
method: f
|
||||
newModifier: 4
|
||||
newName: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
name: B
|
||||
)
|
||||
)
|
40
vendor/nikic/php-parser/test/code/parser/stmt/const.test
vendored
Normal file
40
vendor/nikic/php-parser/test/code/parser/stmt/const.test
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
Global constants
|
||||
-----
|
||||
<?php
|
||||
|
||||
const A = 0, B = 1.0, C = 'A', D = E;
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: A
|
||||
value: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
1: Const(
|
||||
name: B
|
||||
value: Scalar_DNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
2: Const(
|
||||
name: C
|
||||
value: Scalar_String(
|
||||
value: A
|
||||
)
|
||||
)
|
||||
3: Const(
|
||||
name: D
|
||||
value: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
55
vendor/nikic/php-parser/test/code/parser/stmt/controlFlow.test
vendored
Normal file
55
vendor/nikic/php-parser/test/code/parser/stmt/controlFlow.test
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
Control flow statements
|
||||
-----
|
||||
<?php
|
||||
|
||||
break;
|
||||
break 2;
|
||||
|
||||
continue;
|
||||
continue 2;
|
||||
|
||||
return;
|
||||
return $a;
|
||||
|
||||
throw $e;
|
||||
|
||||
label:
|
||||
goto label;
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Break(
|
||||
num: null
|
||||
)
|
||||
1: Stmt_Break(
|
||||
num: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
2: Stmt_Continue(
|
||||
num: null
|
||||
)
|
||||
3: Stmt_Continue(
|
||||
num: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
4: Stmt_Return(
|
||||
expr: null
|
||||
)
|
||||
5: Stmt_Return(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
6: Stmt_Throw(
|
||||
expr: Expr_Variable(
|
||||
name: e
|
||||
)
|
||||
)
|
||||
7: Stmt_Label(
|
||||
name: label
|
||||
)
|
||||
8: Stmt_Goto(
|
||||
name: label
|
||||
)
|
||||
)
|
47
vendor/nikic/php-parser/test/code/parser/stmt/declare.test
vendored
Normal file
47
vendor/nikic/php-parser/test/code/parser/stmt/declare.test
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
Declare
|
||||
-----
|
||||
<?php
|
||||
|
||||
declare (A='B', C='D') {}
|
||||
|
||||
declare (A='B', C='D'):
|
||||
enddeclare;
|
||||
-----
|
||||
array(
|
||||
0: 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(
|
||||
)
|
||||
)
|
||||
1: 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(
|
||||
)
|
||||
)
|
||||
)
|
32
vendor/nikic/php-parser/test/code/parser/stmt/echo.test
vendored
Normal file
32
vendor/nikic/php-parser/test/code/parser/stmt/echo.test
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
Echo
|
||||
-----
|
||||
<?php
|
||||
|
||||
echo 'Hallo World!';
|
||||
echo 'Hallo', ' ', 'World', '!';
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Echo(
|
||||
exprs: array(
|
||||
0: Scalar_String(
|
||||
value: Hallo World!
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Echo(
|
||||
exprs: array(
|
||||
0: Scalar_String(
|
||||
value: Hallo
|
||||
)
|
||||
1: Scalar_String(
|
||||
value:
|
||||
)
|
||||
2: Scalar_String(
|
||||
value: World
|
||||
)
|
||||
3: Scalar_String(
|
||||
value: !
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
37
vendor/nikic/php-parser/test/code/parser/stmt/function/byRef.test
vendored
Normal file
37
vendor/nikic/php-parser/test/code/parser/stmt/function/byRef.test
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
Return and pass by ref
|
||||
-----
|
||||
<?php
|
||||
|
||||
function a(&$b) {}
|
||||
function &a($b) {}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
params: array(
|
||||
0: Param(
|
||||
name: b
|
||||
default: null
|
||||
type: null
|
||||
byRef: true
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
name: a
|
||||
)
|
||||
1: Stmt_Function(
|
||||
byRef: true
|
||||
params: array(
|
||||
0: Param(
|
||||
name: b
|
||||
default: null
|
||||
type: null
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
name: a
|
||||
)
|
||||
)
|
32
vendor/nikic/php-parser/test/code/parser/stmt/function/conditional.test
vendored
Normal file
32
vendor/nikic/php-parser/test/code/parser/stmt/function/conditional.test
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
Conditional function definition
|
||||
-----
|
||||
<?php
|
||||
|
||||
if (true) {
|
||||
function A() {}
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_If(
|
||||
stmts: array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
params: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
name: A
|
||||
)
|
||||
)
|
||||
elseifs: array(
|
||||
)
|
||||
else: null
|
||||
cond: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: true
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
138
vendor/nikic/php-parser/test/code/parser/stmt/function/defaultValues.test
vendored
Normal file
138
vendor/nikic/php-parser/test/code/parser/stmt/function/defaultValues.test
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
Default values (static scalar tests)
|
||||
-----
|
||||
<?php
|
||||
|
||||
function a(
|
||||
$b = null,
|
||||
$c = 'foo',
|
||||
$d = A::B,
|
||||
$f = +1,
|
||||
$g = -1.0,
|
||||
$h = array(),
|
||||
$i = [],
|
||||
$j = ['foo'],
|
||||
$k = ['foo', 'bar' => 'baz']
|
||||
) {}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
params: array(
|
||||
0: Param(
|
||||
name: b
|
||||
default: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: null
|
||||
)
|
||||
)
|
||||
)
|
||||
type: null
|
||||
byRef: false
|
||||
)
|
||||
1: Param(
|
||||
name: c
|
||||
default: Scalar_String(
|
||||
value: foo
|
||||
)
|
||||
type: null
|
||||
byRef: false
|
||||
)
|
||||
2: Param(
|
||||
name: d
|
||||
default: Expr_ClassConstFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: B
|
||||
)
|
||||
type: null
|
||||
byRef: false
|
||||
)
|
||||
3: Param(
|
||||
name: f
|
||||
default: Expr_UnaryPlus(
|
||||
expr: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
type: null
|
||||
byRef: false
|
||||
)
|
||||
4: Param(
|
||||
name: g
|
||||
default: Expr_UnaryMinus(
|
||||
expr: Scalar_DNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
type: null
|
||||
byRef: false
|
||||
)
|
||||
5: Param(
|
||||
name: h
|
||||
default: Expr_Array(
|
||||
items: array(
|
||||
)
|
||||
)
|
||||
type: null
|
||||
byRef: false
|
||||
)
|
||||
6: Param(
|
||||
name: i
|
||||
default: Expr_Array(
|
||||
items: array(
|
||||
)
|
||||
)
|
||||
type: null
|
||||
byRef: false
|
||||
)
|
||||
7: Param(
|
||||
name: j
|
||||
default: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: foo
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
type: null
|
||||
byRef: false
|
||||
)
|
||||
8: Param(
|
||||
name: k
|
||||
default: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: foo
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: Scalar_String(
|
||||
value: bar
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: baz
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
type: null
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
name: a
|
||||
)
|
||||
)
|
227
vendor/nikic/php-parser/test/code/parser/stmt/function/generator.test
vendored
Normal file
227
vendor/nikic/php-parser/test/code/parser/stmt/function/generator.test
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
Generators (yield expression
|
||||
-----
|
||||
<?php
|
||||
|
||||
function gen() {
|
||||
// statements
|
||||
yield;
|
||||
yield $value;
|
||||
yield $key => $value;
|
||||
|
||||
// expressions
|
||||
$data = yield;
|
||||
$data = (yield $value);
|
||||
$data = (yield $key => $value);
|
||||
|
||||
// yield in language constructs with their own parentheses
|
||||
if (yield $foo); elseif (yield $foo);
|
||||
if (yield $foo): elseif (yield $foo): endif;
|
||||
while (yield $foo);
|
||||
do {} while (yield $foo);
|
||||
switch (yield $foo) {}
|
||||
die(yield $foo);
|
||||
|
||||
// yield in function calls
|
||||
func(yield $foo);
|
||||
$foo->func(yield $foo);
|
||||
new Foo(yield $foo);
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
params: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_Yield(
|
||||
key: null
|
||||
value: null
|
||||
)
|
||||
1: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: value
|
||||
)
|
||||
)
|
||||
2: Expr_Yield(
|
||||
key: Expr_Variable(
|
||||
name: key
|
||||
)
|
||||
value: Expr_Variable(
|
||||
name: value
|
||||
)
|
||||
)
|
||||
3: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
name: data
|
||||
)
|
||||
expr: Expr_Yield(
|
||||
key: null
|
||||
value: null
|
||||
)
|
||||
)
|
||||
4: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
name: data
|
||||
)
|
||||
expr: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: value
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
name: data
|
||||
)
|
||||
expr: Expr_Yield(
|
||||
key: Expr_Variable(
|
||||
name: key
|
||||
)
|
||||
value: Expr_Variable(
|
||||
name: value
|
||||
)
|
||||
)
|
||||
)
|
||||
6: Stmt_If(
|
||||
stmts: array(
|
||||
)
|
||||
elseifs: array(
|
||||
0: Stmt_ElseIf(
|
||||
cond: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
else: null
|
||||
cond: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
)
|
||||
7: Stmt_If(
|
||||
stmts: array(
|
||||
)
|
||||
elseifs: array(
|
||||
0: Stmt_ElseIf(
|
||||
cond: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
else: null
|
||||
cond: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
)
|
||||
8: Stmt_While(
|
||||
cond: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
9: Stmt_Do(
|
||||
cond: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
10: Stmt_Switch(
|
||||
cond: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
cases: array(
|
||||
)
|
||||
)
|
||||
11: Expr_Exit(
|
||||
expr: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
)
|
||||
12: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: func
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
13: Expr_MethodCall(
|
||||
var: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
name: func
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
14: Expr_New(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
name: gen
|
||||
)
|
||||
)
|
50
vendor/nikic/php-parser/test/code/parser/stmt/function/specialVars.test
vendored
Normal file
50
vendor/nikic/php-parser/test/code/parser/stmt/function/specialVars.test
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
Special function variables
|
||||
-----
|
||||
<?php
|
||||
|
||||
function a() {
|
||||
global $a, ${'b'}, $$c;
|
||||
static $c, $d = 'e';
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
params: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Global(
|
||||
vars: array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
2: Expr_Variable(
|
||||
name: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Static(
|
||||
vars: array(
|
||||
0: Stmt_StaticVar(
|
||||
name: c
|
||||
default: null
|
||||
)
|
||||
1: Stmt_StaticVar(
|
||||
name: d
|
||||
default: Scalar_String(
|
||||
value: e
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
name: a
|
||||
)
|
||||
)
|
44
vendor/nikic/php-parser/test/code/parser/stmt/function/typeHints.test
vendored
Normal file
44
vendor/nikic/php-parser/test/code/parser/stmt/function/typeHints.test
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
Type hints
|
||||
-----
|
||||
<?php
|
||||
|
||||
function a($b, array $c, callable $d, E $f) {}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
params: array(
|
||||
0: Param(
|
||||
name: b
|
||||
default: null
|
||||
type: null
|
||||
byRef: false
|
||||
)
|
||||
1: Param(
|
||||
name: c
|
||||
default: null
|
||||
type: array
|
||||
byRef: false
|
||||
)
|
||||
2: Param(
|
||||
name: d
|
||||
default: null
|
||||
type: callable
|
||||
byRef: false
|
||||
)
|
||||
3: Param(
|
||||
name: f
|
||||
default: null
|
||||
type: Name(
|
||||
parts: array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
name: a
|
||||
)
|
||||
)
|
55
vendor/nikic/php-parser/test/code/parser/stmt/haltCompiler.test
vendored
Normal file
55
vendor/nikic/php-parser/test/code/parser/stmt/haltCompiler.test
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
__halt_compiler
|
||||
-----
|
||||
<?php
|
||||
|
||||
$a;
|
||||
__halt_compiler()
|
||||
?>
|
||||
Hallo World!
|
||||
-----
|
||||
array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
1: Stmt_HaltCompiler(
|
||||
remaining: Hallo World!
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
|
||||
$a;
|
||||
__halt_compiler();Hallo World!
|
||||
-----
|
||||
array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
1: Stmt_HaltCompiler(
|
||||
remaining: Hallo World!
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace A;
|
||||
$a;
|
||||
__halt_compiler();
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_HaltCompiler(
|
||||
remaining:
|
||||
)
|
||||
)
|
6
vendor/nikic/php-parser/test/code/parser/stmt/haltCompilerInvalidSyntax.test-fail
vendored
Normal file
6
vendor/nikic/php-parser/test/code/parser/stmt/haltCompilerInvalidSyntax.test-fail
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
Invalid __halt_compiler() syntax
|
||||
-----
|
||||
<?php
|
||||
__halt_compiler()
|
||||
-----
|
||||
__halt_compiler must be followed by "();" on line 2
|
8
vendor/nikic/php-parser/test/code/parser/stmt/haltCompilerOutermostScope.test-fail
vendored
Normal file
8
vendor/nikic/php-parser/test/code/parser/stmt/haltCompilerOutermostScope.test-fail
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
__halt_compiler can only be used from outermost scope
|
||||
-----
|
||||
<?php
|
||||
if (true) {
|
||||
__halt_compiler();
|
||||
}
|
||||
-----
|
||||
__halt_compiler() can only be used from the outermost scope on line 3
|
95
vendor/nikic/php-parser/test/code/parser/stmt/if.test
vendored
Normal file
95
vendor/nikic/php-parser/test/code/parser/stmt/if.test
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
If/Elseif/Else
|
||||
-----
|
||||
<?php
|
||||
|
||||
if ($a) {}
|
||||
elseif ($b) {}
|
||||
elseif ($c) {}
|
||||
else {}
|
||||
|
||||
if ($a) {} // without else
|
||||
|
||||
if ($a):
|
||||
elseif ($b):
|
||||
elseif ($c):
|
||||
else :
|
||||
endif;
|
||||
|
||||
if ($a): endif; // without else
|
||||
-----
|
||||
array(
|
||||
0: Stmt_If(
|
||||
stmts: array(
|
||||
)
|
||||
elseifs: array(
|
||||
0: Stmt_ElseIf(
|
||||
cond: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_ElseIf(
|
||||
cond: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
else: Stmt_Else(
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
1: Stmt_If(
|
||||
stmts: array(
|
||||
)
|
||||
elseifs: array(
|
||||
)
|
||||
else: null
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
2: Stmt_If(
|
||||
stmts: array(
|
||||
)
|
||||
elseifs: array(
|
||||
0: Stmt_ElseIf(
|
||||
cond: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_ElseIf(
|
||||
cond: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
else: Stmt_Else(
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
3: Stmt_If(
|
||||
stmts: array(
|
||||
)
|
||||
elseifs: array(
|
||||
)
|
||||
else: null
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
)
|
27
vendor/nikic/php-parser/test/code/parser/stmt/inlineHTML.test
vendored
Normal file
27
vendor/nikic/php-parser/test/code/parser/stmt/inlineHTML.test
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
Inline HTML
|
||||
-----
|
||||
<?php
|
||||
$a;
|
||||
?>
|
||||
B
|
||||
<?php
|
||||
$c;
|
||||
?>
|
||||
<?php
|
||||
$d;
|
||||
-----
|
||||
array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
1: Stmt_InlineHTML(
|
||||
value: B
|
||||
|
||||
)
|
||||
2: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
3: Expr_Variable(
|
||||
name: d
|
||||
)
|
||||
)
|
17
vendor/nikic/php-parser/test/code/parser/stmt/loop/do.test
vendored
Normal file
17
vendor/nikic/php-parser/test/code/parser/stmt/loop/do.test
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
Do loop
|
||||
-----
|
||||
<?php
|
||||
|
||||
do {
|
||||
|
||||
} while ($a);
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Do(
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
86
vendor/nikic/php-parser/test/code/parser/stmt/loop/for.test
vendored
Normal file
86
vendor/nikic/php-parser/test/code/parser/stmt/loop/for.test
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
For loop
|
||||
-----
|
||||
<?php
|
||||
|
||||
// "classical" loop
|
||||
for ($i = 0; $i < $c; ++$i) {}
|
||||
|
||||
// multiple expressions
|
||||
for (;$a,$b;) {}
|
||||
|
||||
// infinite loop
|
||||
for (;;) {}
|
||||
|
||||
// alternative syntax
|
||||
for (;;):
|
||||
endfor;
|
||||
-----
|
||||
array(
|
||||
0: Stmt_For(
|
||||
init: array(
|
||||
0: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
name: i
|
||||
)
|
||||
expr: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
)
|
||||
cond: array(
|
||||
0: Expr_Smaller(
|
||||
left: Expr_Variable(
|
||||
name: i
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
)
|
||||
loop: array(
|
||||
0: Expr_PreInc(
|
||||
var: Expr_Variable(
|
||||
name: i
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_For(
|
||||
init: array(
|
||||
)
|
||||
cond: array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
loop: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
2: Stmt_For(
|
||||
init: array(
|
||||
)
|
||||
cond: array(
|
||||
)
|
||||
loop: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
3: Stmt_For(
|
||||
init: array(
|
||||
)
|
||||
cond: array(
|
||||
)
|
||||
loop: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
139
vendor/nikic/php-parser/test/code/parser/stmt/loop/foreach.test
vendored
Normal file
139
vendor/nikic/php-parser/test/code/parser/stmt/loop/foreach.test
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
Foreach loop
|
||||
-----
|
||||
<?php
|
||||
|
||||
// foreach on variable
|
||||
foreach ($a as $b) {}
|
||||
foreach ($a as &$b) {}
|
||||
foreach ($a as $b => $c) {}
|
||||
foreach ($a as $b => &$c) {}
|
||||
foreach ($a as list($a, $b)) {}
|
||||
foreach ($a as $a => list($b, , $c)) {}
|
||||
|
||||
// foreach on expression
|
||||
foreach (array() as $b) {}
|
||||
|
||||
// alternative syntax
|
||||
foreach ($a as $b):
|
||||
endforeach;
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Foreach(
|
||||
keyVar: null
|
||||
byRef: false
|
||||
stmts: array(
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
valueVar: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
1: Stmt_Foreach(
|
||||
keyVar: null
|
||||
byRef: true
|
||||
stmts: array(
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
valueVar: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
2: Stmt_Foreach(
|
||||
keyVar: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
stmts: array(
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
valueVar: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
3: Stmt_Foreach(
|
||||
keyVar: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: true
|
||||
stmts: array(
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
valueVar: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
4: Stmt_Foreach(
|
||||
keyVar: null
|
||||
byRef: false
|
||||
stmts: array(
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
valueVar: Expr_List(
|
||||
vars: array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Stmt_Foreach(
|
||||
keyVar: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: false
|
||||
stmts: array(
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
valueVar: Expr_List(
|
||||
vars: array(
|
||||
0: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
1: null
|
||||
2: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
6: Stmt_Foreach(
|
||||
keyVar: null
|
||||
byRef: false
|
||||
stmts: array(
|
||||
)
|
||||
expr: Expr_Array(
|
||||
items: array(
|
||||
)
|
||||
)
|
||||
valueVar: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
7: Stmt_Foreach(
|
||||
keyVar: null
|
||||
byRef: false
|
||||
stmts: array(
|
||||
)
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
valueVar: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
)
|
25
vendor/nikic/php-parser/test/code/parser/stmt/loop/while.test
vendored
Normal file
25
vendor/nikic/php-parser/test/code/parser/stmt/loop/while.test
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
While loop
|
||||
-----
|
||||
<?php
|
||||
|
||||
while ($a) {}
|
||||
|
||||
while ($a):
|
||||
endwhile;
|
||||
-----
|
||||
array(
|
||||
0: Stmt_While(
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_While(
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
85
vendor/nikic/php-parser/test/code/parser/stmt/namespace/alias.test
vendored
Normal file
85
vendor/nikic/php-parser/test/code/parser/stmt/namespace/alias.test
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
Aliases (use)
|
||||
-----
|
||||
<?php
|
||||
|
||||
use A\B;
|
||||
use C\D as E;
|
||||
use F\G as H, J;
|
||||
|
||||
// evil alias notation - Do Not Use!
|
||||
use \A;
|
||||
use \A as B;
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Use(
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
)
|
||||
)
|
||||
alias: B
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Use(
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
1: D
|
||||
)
|
||||
)
|
||||
alias: E
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_Use(
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: F
|
||||
1: G
|
||||
)
|
||||
)
|
||||
alias: H
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: J
|
||||
)
|
||||
)
|
||||
alias: J
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Stmt_Use(
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
alias: A
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Stmt_Use(
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
alias: B
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
42
vendor/nikic/php-parser/test/code/parser/stmt/namespace/braced.test
vendored
Normal file
42
vendor/nikic/php-parser/test/code/parser/stmt/namespace/braced.test
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
Braced namespaces
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Foo\Bar {
|
||||
foo;
|
||||
}
|
||||
namespace {
|
||||
bar;
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
1: Bar
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Namespace(
|
||||
name: null
|
||||
stmts: array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: bar
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
13
vendor/nikic/php-parser/test/code/parser/stmt/namespace/mix.test-fail
vendored
Normal file
13
vendor/nikic/php-parser/test/code/parser/stmt/namespace/mix.test-fail
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
Namespace types cannot be mixed
|
||||
-----
|
||||
<?php
|
||||
namespace A;
|
||||
namespace B {}
|
||||
-----
|
||||
Cannot mix bracketed namespace declarations with unbracketed namespace declarations on line 3
|
||||
-----
|
||||
<?php
|
||||
namespace A {}
|
||||
namespace B;
|
||||
-----
|
||||
Cannot mix bracketed namespace declarations with unbracketed namespace declarations on line 3
|
42
vendor/nikic/php-parser/test/code/parser/stmt/namespace/name.test
vendored
Normal file
42
vendor/nikic/php-parser/test/code/parser/stmt/namespace/name.test
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
Different name types
|
||||
-----
|
||||
<?php
|
||||
|
||||
A;
|
||||
A\B;
|
||||
\A\B;
|
||||
namespace\A\B;
|
||||
-----
|
||||
array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Expr_ConstFetch(
|
||||
name: Name_FullyQualified(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Expr_ConstFetch(
|
||||
name: Name_Relative(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
25
vendor/nikic/php-parser/test/code/parser/stmt/namespace/name.test-fail
vendored
Normal file
25
vendor/nikic/php-parser/test/code/parser/stmt/namespace/name.test-fail
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
Invalid namespace names
|
||||
-----
|
||||
<?php namespace self;
|
||||
-----
|
||||
Cannot use "self" as namespace name as it is reserved on line 1
|
||||
-----
|
||||
<?php namespace parent;
|
||||
-----
|
||||
Cannot use "parent" as namespace name as it is reserved on line 1
|
||||
-----
|
||||
<?php namespace static;
|
||||
-----
|
||||
Syntax error, unexpected T_STATIC, expecting T_STRING or T_NS_SEPARATOR or '{' on line 1
|
||||
-----
|
||||
<?php use A as self;
|
||||
-----
|
||||
Cannot use "A" as "self" because "self" is a special class name on line 1
|
||||
-----
|
||||
<?php use B as parent;
|
||||
-----
|
||||
Cannot use "B" as "parent" because "parent" is a special class name on line 1
|
||||
-----
|
||||
<?php use C as static;
|
||||
-----
|
||||
Syntax error, unexpected T_STATIC, expecting T_STRING on line 1
|
10
vendor/nikic/php-parser/test/code/parser/stmt/namespace/nested.test-fail
vendored
Normal file
10
vendor/nikic/php-parser/test/code/parser/stmt/namespace/nested.test-fail
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
Nested namespaces are not allowed
|
||||
-----
|
||||
<?php
|
||||
namespace A {
|
||||
namespace B {
|
||||
|
||||
}
|
||||
}
|
||||
-----
|
||||
Namespace declarations cannot be nested on line 3
|
45
vendor/nikic/php-parser/test/code/parser/stmt/namespace/notBraced.test
vendored
Normal file
45
vendor/nikic/php-parser/test/code/parser/stmt/namespace/notBraced.test
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
Semicolon style namespaces
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Foo\Bar;
|
||||
foo;
|
||||
|
||||
namespace Bar;
|
||||
bar;
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
1: Bar
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Bar
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: bar
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
37
vendor/nikic/php-parser/test/code/parser/stmt/namespace/outsideStmt.test
vendored
Normal file
37
vendor/nikic/php-parser/test/code/parser/stmt/namespace/outsideStmt.test
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
Some statements may occur outside of namespaces
|
||||
-----
|
||||
<?php
|
||||
declare(A='B');
|
||||
namespace B {
|
||||
|
||||
}
|
||||
__halt_compiler()
|
||||
?>
|
||||
Hi!
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Declare(
|
||||
declares: array(
|
||||
0: Stmt_DeclareDeclare(
|
||||
key: A
|
||||
value: Scalar_String(
|
||||
value: B
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
2: Stmt_HaltCompiler(
|
||||
remaining: Hi!
|
||||
)
|
||||
)
|
13
vendor/nikic/php-parser/test/code/parser/stmt/namespace/outsideStmt.test-fail
vendored
Normal file
13
vendor/nikic/php-parser/test/code/parser/stmt/namespace/outsideStmt.test-fail
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
There (mostly) can't be statements outside of namespaces
|
||||
-----
|
||||
<?php
|
||||
echo 1;
|
||||
namespace A;
|
||||
-----
|
||||
Namespace declaration statement has to be the very first statement in the script on line 3
|
||||
-----
|
||||
<?php
|
||||
namespace A {}
|
||||
echo 1;
|
||||
-----
|
||||
No code may exist outside of namespace {} on line 3
|
67
vendor/nikic/php-parser/test/code/parser/stmt/switch.test
vendored
Normal file
67
vendor/nikic/php-parser/test/code/parser/stmt/switch.test
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
Switch
|
||||
-----
|
||||
<?php
|
||||
|
||||
switch ($a) {
|
||||
case 0:
|
||||
case 1;
|
||||
default:
|
||||
}
|
||||
|
||||
// alternative syntax
|
||||
switch ($a):
|
||||
endswitch;
|
||||
|
||||
// leading semicolon
|
||||
switch ($a) { ; }
|
||||
switch ($a): ; endswitch;
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Switch(
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
cases: array(
|
||||
0: Stmt_Case(
|
||||
cond: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_Case(
|
||||
cond: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
2: Stmt_Case(
|
||||
cond: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Switch(
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
cases: array(
|
||||
)
|
||||
)
|
||||
2: Stmt_Switch(
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
cases: array(
|
||||
)
|
||||
)
|
||||
3: Stmt_Switch(
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
cases: array(
|
||||
)
|
||||
)
|
||||
)
|
114
vendor/nikic/php-parser/test/code/parser/stmt/tryCatch.test
vendored
Normal file
114
vendor/nikic/php-parser/test/code/parser/stmt/tryCatch.test
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
Try/catch
|
||||
-----
|
||||
<?php
|
||||
|
||||
try {
|
||||
doTry();
|
||||
} catch (A $b) {
|
||||
doCatchA();
|
||||
} catch (B $c) {
|
||||
doCatchB();
|
||||
} finally {
|
||||
doFinally();
|
||||
}
|
||||
|
||||
// no finally
|
||||
try { }
|
||||
catch (A $b) { }
|
||||
|
||||
// no catch
|
||||
try { }
|
||||
finally { }
|
||||
|
||||
-----
|
||||
array(
|
||||
0: Stmt_TryCatch(
|
||||
stmts: array(
|
||||
0: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: doTry
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
catches: array(
|
||||
0: Stmt_Catch(
|
||||
type: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
var: b
|
||||
stmts: array(
|
||||
0: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: doCatchA
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Catch(
|
||||
type: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
var: c
|
||||
stmts: array(
|
||||
0: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: doCatchB
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
finallyStmts: array(
|
||||
0: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: doFinally
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_TryCatch(
|
||||
stmts: array(
|
||||
)
|
||||
catches: array(
|
||||
0: Stmt_Catch(
|
||||
type: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
var: b
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
finallyStmts: null
|
||||
)
|
||||
2: Stmt_TryCatch(
|
||||
stmts: array(
|
||||
)
|
||||
catches: array(
|
||||
)
|
||||
finallyStmts: array(
|
||||
)
|
||||
)
|
||||
)
|
7
vendor/nikic/php-parser/test/code/parser/stmt/tryCatch.test-fail
vendored
Normal file
7
vendor/nikic/php-parser/test/code/parser/stmt/tryCatch.test-fail
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
Cannot use try without catch or finally
|
||||
-----
|
||||
<?php
|
||||
|
||||
try { }
|
||||
-----
|
||||
Cannot use try without catch or finally on line 3
|
26
vendor/nikic/php-parser/test/code/parser/stmt/unset.test
vendored
Normal file
26
vendor/nikic/php-parser/test/code/parser/stmt/unset.test
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
Unset
|
||||
-----
|
||||
<?php
|
||||
|
||||
unset($a);
|
||||
unset($b, $c);
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Unset(
|
||||
vars: array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Unset(
|
||||
vars: array(
|
||||
0: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
Reference in New Issue
Block a user