Laravel version update
Laravel version update
This commit is contained in:
@@ -22,8 +22,10 @@ array(
|
||||
name: a
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: A
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Variable(
|
||||
name: A
|
||||
)
|
||||
)
|
||||
)
|
||||
elseifs: array(
|
||||
@@ -32,16 +34,20 @@ array(
|
||||
name: b
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: B
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Variable(
|
||||
name: B
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
else: Stmt_Else(
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: C
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Variable(
|
||||
name: C
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -54,8 +60,10 @@ array(
|
||||
loop: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: foo
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -69,8 +77,10 @@ array(
|
||||
name: b
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: AB
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Variable(
|
||||
name: AB
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -79,33 +89,41 @@ array(
|
||||
name: a
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: A
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Variable(
|
||||
name: A
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Stmt_Do(
|
||||
stmts: array(
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Variable(
|
||||
name: A
|
||||
)
|
||||
)
|
||||
)
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: A
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Stmt_Declare(
|
||||
declares: array(
|
||||
0: Stmt_DeclareDeclare(
|
||||
key: a
|
||||
key: Identifier(
|
||||
name: a
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: C
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Variable(
|
||||
name: C
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@@ -9,16 +9,20 @@ abstract class A {
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
type: 16
|
||||
name: A
|
||||
flags: MODIFIER_ABSTRACT (16)
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
type: 1
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
byRef: false
|
||||
name: a
|
||||
name: Identifier(
|
||||
name: a
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
@@ -26,9 +30,11 @@ array(
|
||||
)
|
||||
)
|
||||
1: Stmt_ClassMethod(
|
||||
type: 17
|
||||
flags: MODIFIER_PUBLIC | MODIFIER_ABSTRACT (17)
|
||||
byRef: false
|
||||
name: b
|
||||
name: Identifier(
|
||||
name: b
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
@@ -36,4 +42,4 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -22,131 +22,147 @@ class A {
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Expr_New(
|
||||
class: Stmt_Class(
|
||||
type: 0
|
||||
name: null
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
type: 1
|
||||
byRef: false
|
||||
name: test
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_New(
|
||||
class: Stmt_Class(
|
||||
flags: 0
|
||||
name: null
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
1: Expr_New(
|
||||
class: Stmt_Class(
|
||||
type: 0
|
||||
name: null
|
||||
extends: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
implements: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
1: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
2: Expr_New(
|
||||
class: Stmt_Class(
|
||||
type: 0
|
||||
name: null
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
type: 1
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: foo
|
||||
default: null
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
byRef: false
|
||||
name: Identifier(
|
||||
name: test
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Expr_New(
|
||||
class: Stmt_Class(
|
||||
type: 0
|
||||
name: null
|
||||
extends: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
1: Stmt_Expression(
|
||||
expr: Expr_New(
|
||||
class: Stmt_Class(
|
||||
flags: 0
|
||||
name: null
|
||||
extends: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
implements: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
1: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
implements: array(
|
||||
args: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_TraitUse(
|
||||
traits: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: T
|
||||
)
|
||||
)
|
||||
2: Stmt_Expression(
|
||||
expr: Expr_New(
|
||||
class: Stmt_Class(
|
||||
flags: 0
|
||||
name: null
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: VarLikeIdentifier(
|
||||
name: foo
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
adaptations: array(
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Stmt_Expression(
|
||||
expr: Expr_New(
|
||||
class: Stmt_Class(
|
||||
flags: 0
|
||||
name: null
|
||||
extends: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_TraitUse(
|
||||
traits: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: T
|
||||
)
|
||||
)
|
||||
)
|
||||
adaptations: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
1: Arg(
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
1: Arg(
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Stmt_Class(
|
||||
type: 0
|
||||
name: A
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
type: 1
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
byRef: false
|
||||
name: test
|
||||
name: Identifier(
|
||||
name: test
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
@@ -154,7 +170,7 @@ array(
|
||||
0: Stmt_Return(
|
||||
expr: Expr_New(
|
||||
class: Stmt_Class(
|
||||
type: 0
|
||||
flags: 0
|
||||
name: null
|
||||
extends: Name(
|
||||
parts: array(
|
||||
@@ -165,9 +181,12 @@ array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassConst(
|
||||
flags: 0
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: A
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: B
|
||||
)
|
||||
@@ -191,4 +210,4 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -17,8 +17,10 @@ array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Class(
|
||||
type: 0
|
||||
name: A
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
|
137
vendor/nikic/php-parser/test/code/parser/stmt/class/constModifierErrors.test
vendored
Normal file
137
vendor/nikic/php-parser/test/code/parser/stmt/class/constModifierErrors.test
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
Invalid class constant modifiers
|
||||
-----
|
||||
<?php
|
||||
class A {
|
||||
static const X = 1;
|
||||
}
|
||||
-----
|
||||
!!php7
|
||||
Cannot use 'static' as constant modifier from 3:5 to 3:10
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassConst(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: Identifier(
|
||||
name: X
|
||||
)
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
class A {
|
||||
abstract const X = 1;
|
||||
}
|
||||
-----
|
||||
!!php7
|
||||
Cannot use 'abstract' as constant modifier from 3:5 to 3:12
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassConst(
|
||||
flags: MODIFIER_ABSTRACT (16)
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: Identifier(
|
||||
name: X
|
||||
)
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
class A {
|
||||
final const X = 1;
|
||||
}
|
||||
-----
|
||||
!!php7
|
||||
Cannot use 'final' as constant modifier from 3:5 to 3:9
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassConst(
|
||||
flags: MODIFIER_FINAL (32)
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: Identifier(
|
||||
name: X
|
||||
)
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
class A {
|
||||
public public const X = 1;
|
||||
}
|
||||
-----
|
||||
!!php7
|
||||
Multiple access type modifiers are not allowed from 3:12 to 3:17
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassConst(
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: Identifier(
|
||||
name: X
|
||||
)
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
77
vendor/nikic/php-parser/test/code/parser/stmt/class/constModifiers.test
vendored
Normal file
77
vendor/nikic/php-parser/test/code/parser/stmt/class/constModifiers.test
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
Class constant modifiers
|
||||
-----
|
||||
<?php
|
||||
|
||||
class Foo {
|
||||
const A = 1;
|
||||
public const B = 2;
|
||||
protected const C = 3;
|
||||
private const D = 4;
|
||||
}
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: Foo
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassConst(
|
||||
flags: 0
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_ClassConst(
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: Identifier(
|
||||
name: B
|
||||
)
|
||||
value: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_ClassConst(
|
||||
flags: MODIFIER_PROTECTED (2)
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: Identifier(
|
||||
name: C
|
||||
)
|
||||
value: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Stmt_ClassConst(
|
||||
flags: MODIFIER_PRIVATE (4)
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: Identifier(
|
||||
name: D
|
||||
)
|
||||
value: Scalar_LNumber(
|
||||
value: 4
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -6,8 +6,10 @@ final class A {}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
type: 32
|
||||
name: A
|
||||
flags: MODIFIER_FINAL (32)
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
|
@@ -14,43 +14,53 @@ abstract class A {
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
type: 16
|
||||
name: A
|
||||
flags: MODIFIER_ABSTRACT (16)
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
type: 0
|
||||
flags: 0
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: a
|
||||
name: VarLikeIdentifier(
|
||||
name: a
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Property(
|
||||
type: 8
|
||||
flags: MODIFIER_STATIC (8)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: b
|
||||
name: VarLikeIdentifier(
|
||||
name: b
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_ClassMethod(
|
||||
type: 16
|
||||
flags: MODIFIER_ABSTRACT (16)
|
||||
byRef: false
|
||||
name: c
|
||||
name: Identifier(
|
||||
name: c
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: null
|
||||
)
|
||||
3: Stmt_ClassMethod(
|
||||
type: 32
|
||||
flags: MODIFIER_FINAL (32)
|
||||
byRef: false
|
||||
name: d
|
||||
name: Identifier(
|
||||
name: d
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
@@ -58,9 +68,11 @@ array(
|
||||
)
|
||||
)
|
||||
4: Stmt_ClassMethod(
|
||||
type: 8
|
||||
flags: MODIFIER_STATIC (8)
|
||||
byRef: false
|
||||
name: e
|
||||
name: Identifier(
|
||||
name: e
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
@@ -68,9 +80,11 @@ array(
|
||||
)
|
||||
)
|
||||
5: Stmt_ClassMethod(
|
||||
type: 40
|
||||
flags: MODIFIER_STATIC | MODIFIER_FINAL (40)
|
||||
byRef: false
|
||||
name: f
|
||||
name: Identifier(
|
||||
name: f
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
@@ -78,9 +92,11 @@ array(
|
||||
)
|
||||
)
|
||||
6: Stmt_ClassMethod(
|
||||
type: 0
|
||||
flags: 0
|
||||
byRef: false
|
||||
name: g
|
||||
name: Identifier(
|
||||
name: g
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
@@ -89,4 +105,4 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -8,7 +8,9 @@ interface A extends C, D {
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Interface(
|
||||
name: A
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
@@ -23,9 +25,11 @@ array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
type: 1
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
byRef: false
|
||||
name: a
|
||||
name: Identifier(
|
||||
name: a
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
@@ -33,4 +37,4 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -2,27 +2,172 @@ Invalid modifier combination
|
||||
-----
|
||||
<?php class A { public public $a; }
|
||||
-----
|
||||
Multiple access type modifiers are not allowed on line 1
|
||||
Multiple access type modifiers are not allowed from 1:24 to 1:29
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: VarLikeIdentifier(
|
||||
name: a
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { public protected $a; }
|
||||
-----
|
||||
Multiple access type modifiers are not allowed on line 1
|
||||
Multiple access type modifiers are not allowed from 1:24 to 1:32
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
flags: MODIFIER_PUBLIC | MODIFIER_PROTECTED (3)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: VarLikeIdentifier(
|
||||
name: a
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { abstract abstract a(); }
|
||||
<?php class A { abstract abstract function a(); }
|
||||
-----
|
||||
Multiple abstract modifiers are not allowed on line 1
|
||||
Multiple abstract modifiers are not allowed from 1:26 to 1:33
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_ABSTRACT (16)
|
||||
byRef: false
|
||||
name: Identifier(
|
||||
name: a
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { static static $a; }
|
||||
-----
|
||||
Multiple static modifiers are not allowed on line 1
|
||||
Multiple static modifiers are not allowed from 1:24 to 1:29
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: VarLikeIdentifier(
|
||||
name: a
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { final final a() {} }
|
||||
<?php class A { final final function a() {} }
|
||||
-----
|
||||
Multiple final modifiers are not allowed on line 1
|
||||
Multiple final modifiers are not allowed from 1:23 to 1:27
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_FINAL (32)
|
||||
byRef: false
|
||||
name: Identifier(
|
||||
name: a
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { abstract final a(); }
|
||||
<?php class A { abstract final function a(); }
|
||||
-----
|
||||
Cannot use the final modifier on an abstract class member on line 1
|
||||
Cannot use the final modifier on an abstract class member from 1:26 to 1:30
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_ABSTRACT | MODIFIER_FINAL (48)
|
||||
byRef: false
|
||||
name: Identifier(
|
||||
name: a
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php abstract final class A { }
|
||||
// Type in the partial parse could conceivably be any of 0, 16 or 32
|
||||
@@ -30,8 +175,10 @@ Cannot use the final modifier on an abstract class member on line 1
|
||||
Syntax error, unexpected T_FINAL, expecting T_CLASS from 1:16 to 1:20
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
type: 32
|
||||
name: A
|
||||
flags: MODIFIER_FINAL (32)
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
@@ -47,8 +194,56 @@ array(
|
||||
-----
|
||||
<?php class A { abstract $a; }
|
||||
-----
|
||||
Properties cannot be declared abstract on line 1
|
||||
Properties cannot be declared abstract from 1:17 to 1:24
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
flags: MODIFIER_ABSTRACT (16)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: VarLikeIdentifier(
|
||||
name: a
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { final $a; }
|
||||
-----
|
||||
Properties cannot be declared final on line 1
|
||||
Properties cannot be declared final from 1:17 to 1:21
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
flags: MODIFIER_FINAL (32)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: VarLikeIdentifier(
|
||||
name: a
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -2,11 +2,37 @@ Invalid class name
|
||||
-----
|
||||
<?php class self {}
|
||||
-----
|
||||
Cannot use 'self' as class name as it is reserved on line 1
|
||||
Cannot use 'self' as class name as it is reserved from 1:13 to 1:16
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: self
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class PARENT {}
|
||||
-----
|
||||
Cannot use 'PARENT' as class name as it is reserved on line 1
|
||||
Cannot use 'PARENT' as class name as it is reserved from 1:13 to 1:18
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: PARENT
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class static {}
|
||||
-----
|
||||
@@ -17,38 +43,161 @@ array(
|
||||
<?php class A extends self {}
|
||||
-----
|
||||
Cannot use 'self' as class name as it is reserved from 1:23 to 1:26
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: Name(
|
||||
parts: array(
|
||||
0: self
|
||||
)
|
||||
)
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A extends PARENT {}
|
||||
-----
|
||||
Cannot use 'PARENT' as class name as it is reserved from 1:23 to 1:28
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: Name(
|
||||
parts: array(
|
||||
0: PARENT
|
||||
)
|
||||
)
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A extends static {}
|
||||
-----
|
||||
Syntax error, unexpected T_STATIC, expecting T_STRING or T_NAMESPACE or T_NS_SEPARATOR from 1:23 to 1:28
|
||||
Cannot use 'static' as class name as it is reserved from 1:23 to 1:28
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: Name(
|
||||
parts: array(
|
||||
0: static
|
||||
)
|
||||
)
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A implements self {}
|
||||
-----
|
||||
Cannot use 'self' as interface name as it is reserved from 1:26 to 1:29
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: self
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A implements PARENT {}
|
||||
-----
|
||||
Cannot use 'PARENT' as interface name as it is reserved from 1:26 to 1:31
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: PARENT
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A implements static {}
|
||||
-----
|
||||
Syntax error, unexpected T_STATIC, expecting T_STRING or T_NAMESPACE or T_NS_SEPARATOR from 1:26 to 1:31
|
||||
Cannot use 'static' as interface name as it is reserved from 1:26 to 1:31
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: static
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php interface self {}
|
||||
-----
|
||||
Cannot use 'self' as class name as it is reserved on line 1
|
||||
Cannot use 'self' as class name as it is reserved from 1:17 to 1:20
|
||||
array(
|
||||
0: Stmt_Interface(
|
||||
name: Identifier(
|
||||
name: self
|
||||
)
|
||||
extends: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php interface PARENT {}
|
||||
-----
|
||||
Cannot use 'PARENT' as class name as it is reserved on line 1
|
||||
Cannot use 'PARENT' as class name as it is reserved from 1:17 to 1:22
|
||||
array(
|
||||
0: Stmt_Interface(
|
||||
name: Identifier(
|
||||
name: PARENT
|
||||
)
|
||||
extends: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php interface static {}
|
||||
-----
|
||||
@@ -59,13 +208,59 @@ array(
|
||||
<?php interface A extends self {}
|
||||
-----
|
||||
Cannot use 'self' as interface name as it is reserved from 1:27 to 1:30
|
||||
array(
|
||||
0: Stmt_Interface(
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: self
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php interface A extends PARENT {}
|
||||
-----
|
||||
Cannot use 'PARENT' as interface name as it is reserved from 1:27 to 1:32
|
||||
array(
|
||||
0: Stmt_Interface(
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: PARENT
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php interface A extends static {}
|
||||
-----
|
||||
Syntax error, unexpected T_STATIC, expecting T_STRING or T_NAMESPACE or T_NS_SEPARATOR from 1:27 to 1:32
|
||||
Cannot use 'static' as interface name as it is reserved from 1:27 to 1:32
|
||||
array(
|
||||
)
|
||||
0: Stmt_Interface(
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: static
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
@@ -10,25 +10,31 @@ class A {
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
type: 0
|
||||
name: A
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
type: 0
|
||||
flags: 0
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: foo
|
||||
name: VarLikeIdentifier(
|
||||
name: foo
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_ClassMethod(
|
||||
type: 0
|
||||
flags: 0
|
||||
byRef: false
|
||||
name: bar
|
||||
name: Identifier(
|
||||
name: bar
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
@@ -36,9 +42,11 @@ array(
|
||||
)
|
||||
)
|
||||
2: Stmt_ClassMethod(
|
||||
type: 24
|
||||
flags: MODIFIER_ABSTRACT | MODIFIER_STATIC (24)
|
||||
byRef: false
|
||||
name: baz
|
||||
name: Identifier(
|
||||
name: baz
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
@@ -47,4 +55,4 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -18,8 +18,10 @@ class A extends B implements C, D {
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
type: 0
|
||||
name: A
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
@@ -39,15 +41,20 @@ array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassConst(
|
||||
flags: 0
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: A
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: B
|
||||
)
|
||||
)
|
||||
1: Const(
|
||||
name: C
|
||||
name: Identifier(
|
||||
name: C
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: D
|
||||
)
|
||||
@@ -55,16 +62,20 @@ array(
|
||||
)
|
||||
)
|
||||
1: Stmt_Property(
|
||||
type: 1
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: a
|
||||
name: VarLikeIdentifier(
|
||||
name: a
|
||||
)
|
||||
default: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
1: Stmt_PropertyProperty(
|
||||
name: c
|
||||
name: VarLikeIdentifier(
|
||||
name: c
|
||||
)
|
||||
default: Scalar_String(
|
||||
value: d
|
||||
)
|
||||
@@ -72,27 +83,33 @@ array(
|
||||
)
|
||||
)
|
||||
2: Stmt_Property(
|
||||
type: 2
|
||||
flags: MODIFIER_PROTECTED (2)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: e
|
||||
name: VarLikeIdentifier(
|
||||
name: e
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Stmt_Property(
|
||||
type: 4
|
||||
flags: MODIFIER_PRIVATE (4)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: f
|
||||
name: VarLikeIdentifier(
|
||||
name: f
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Stmt_ClassMethod(
|
||||
type: 1
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
byRef: false
|
||||
name: a
|
||||
name: Identifier(
|
||||
name: a
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
@@ -100,15 +117,19 @@ array(
|
||||
)
|
||||
)
|
||||
5: Stmt_ClassMethod(
|
||||
type: 9
|
||||
flags: MODIFIER_PUBLIC | MODIFIER_STATIC (9)
|
||||
byRef: false
|
||||
name: b
|
||||
name: Identifier(
|
||||
name: b
|
||||
)
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: a
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
@@ -117,9 +138,11 @@ array(
|
||||
)
|
||||
)
|
||||
6: Stmt_ClassMethod(
|
||||
type: 33
|
||||
flags: MODIFIER_PUBLIC | MODIFIER_FINAL (33)
|
||||
byRef: false
|
||||
name: c
|
||||
name: Identifier(
|
||||
name: c
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: Name(
|
||||
@@ -131,9 +154,11 @@ array(
|
||||
)
|
||||
)
|
||||
7: Stmt_ClassMethod(
|
||||
type: 2
|
||||
flags: MODIFIER_PROTECTED (2)
|
||||
byRef: false
|
||||
name: d
|
||||
name: Identifier(
|
||||
name: d
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
@@ -141,9 +166,11 @@ array(
|
||||
)
|
||||
)
|
||||
8: Stmt_ClassMethod(
|
||||
type: 4
|
||||
flags: MODIFIER_PRIVATE (4)
|
||||
byRef: false
|
||||
name: e
|
||||
name: Identifier(
|
||||
name: e
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
@@ -152,4 +179,4 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -2,24 +2,174 @@ Some special methods cannot be static
|
||||
-----
|
||||
<?php class A { static function __construct() {} }
|
||||
-----
|
||||
Constructor __construct() cannot be static on line 1
|
||||
Constructor __construct() cannot be static from 1:17 to 1:22
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
byRef: false
|
||||
name: Identifier(
|
||||
name: __construct
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { static function __destruct() {} }
|
||||
-----
|
||||
Destructor __destruct() cannot be static on line 1
|
||||
Destructor __destruct() cannot be static from 1:17 to 1:22
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
byRef: false
|
||||
name: Identifier(
|
||||
name: __destruct
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { static function __clone() {} }
|
||||
-----
|
||||
Clone method __clone() cannot be static on line 1
|
||||
Clone method __clone() cannot be static from 1:17 to 1:22
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
byRef: false
|
||||
name: Identifier(
|
||||
name: __clone
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { static function __CONSTRUCT() {} }
|
||||
-----
|
||||
Constructor __CONSTRUCT() cannot be static on line 1
|
||||
Constructor __CONSTRUCT() cannot be static from 1:17 to 1:22
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
byRef: false
|
||||
name: Identifier(
|
||||
name: __CONSTRUCT
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { static function __Destruct() {} }
|
||||
-----
|
||||
Destructor __Destruct() cannot be static on line 1
|
||||
Destructor __Destruct() cannot be static from 1:17 to 1:22
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
byRef: false
|
||||
name: Identifier(
|
||||
name: __Destruct
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { static function __cLoNe() {} }
|
||||
-----
|
||||
Clone method __cLoNe() cannot be static on line 1
|
||||
Clone method __cLoNe() cannot be static from 1:17 to 1:22
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
byRef: false
|
||||
name: Identifier(
|
||||
name: __cLoNe
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -23,12 +23,16 @@ class B {
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Trait(
|
||||
name: A
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
type: 1
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
byRef: false
|
||||
name: a
|
||||
name: Identifier(
|
||||
name: a
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
@@ -38,8 +42,10 @@ array(
|
||||
)
|
||||
)
|
||||
1: Stmt_Class(
|
||||
type: 0
|
||||
name: B
|
||||
flags: 0
|
||||
name: Identifier(
|
||||
name: B
|
||||
)
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
@@ -66,20 +72,30 @@ array(
|
||||
adaptations: array(
|
||||
0: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: null
|
||||
method: a
|
||||
newModifier: 2
|
||||
newName: b
|
||||
method: Identifier(
|
||||
name: a
|
||||
)
|
||||
newModifier: MODIFIER_PROTECTED (2)
|
||||
newName: Identifier(
|
||||
name: b
|
||||
)
|
||||
)
|
||||
1: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: null
|
||||
method: c
|
||||
method: Identifier(
|
||||
name: c
|
||||
)
|
||||
newModifier: null
|
||||
newName: d
|
||||
newName: Identifier(
|
||||
name: d
|
||||
)
|
||||
)
|
||||
2: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: null
|
||||
method: e
|
||||
newModifier: 4
|
||||
method: Identifier(
|
||||
name: e
|
||||
)
|
||||
newModifier: MODIFIER_PRIVATE (4)
|
||||
newName: null
|
||||
)
|
||||
)
|
||||
@@ -109,7 +125,9 @@ array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
method: a
|
||||
method: Identifier(
|
||||
name: a
|
||||
)
|
||||
insteadof: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
@@ -129,9 +147,13 @@ array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
method: b
|
||||
newModifier: 2
|
||||
newName: c
|
||||
method: Identifier(
|
||||
name: b
|
||||
)
|
||||
newModifier: MODIFIER_PROTECTED (2)
|
||||
newName: Identifier(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
2: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: Name(
|
||||
@@ -139,9 +161,13 @@ array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
method: d
|
||||
method: Identifier(
|
||||
name: d
|
||||
)
|
||||
newModifier: null
|
||||
newName: e
|
||||
newName: Identifier(
|
||||
name: e
|
||||
)
|
||||
)
|
||||
3: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: Name(
|
||||
@@ -149,12 +175,14 @@ array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
method: f
|
||||
newModifier: 4
|
||||
method: Identifier(
|
||||
name: f
|
||||
)
|
||||
newModifier: MODIFIER_PRIVATE (4)
|
||||
newName: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -8,25 +8,33 @@ array(
|
||||
0: Stmt_Const(
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: A
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
value: Scalar_LNumber(
|
||||
value: 0
|
||||
)
|
||||
)
|
||||
1: Const(
|
||||
name: B
|
||||
name: Identifier(
|
||||
name: B
|
||||
)
|
||||
value: Scalar_DNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
2: Const(
|
||||
name: C
|
||||
name: Identifier(
|
||||
name: C
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: A
|
||||
)
|
||||
)
|
||||
3: Const(
|
||||
name: D
|
||||
name: Identifier(
|
||||
name: D
|
||||
)
|
||||
value: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
|
@@ -47,9 +47,13 @@ array(
|
||||
)
|
||||
)
|
||||
7: Stmt_Label(
|
||||
name: label
|
||||
name: Identifier(
|
||||
name: label
|
||||
)
|
||||
)
|
||||
8: Stmt_Goto(
|
||||
name: label
|
||||
name: Identifier(
|
||||
name: label
|
||||
)
|
||||
)
|
||||
)
|
@@ -13,7 +13,9 @@ array(
|
||||
0: Stmt_Declare(
|
||||
declares: array(
|
||||
0: Stmt_DeclareDeclare(
|
||||
key: X
|
||||
key: Identifier(
|
||||
name: X
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: Y
|
||||
)
|
||||
@@ -24,13 +26,17 @@ array(
|
||||
1: Stmt_Declare(
|
||||
declares: array(
|
||||
0: Stmt_DeclareDeclare(
|
||||
key: A
|
||||
key: Identifier(
|
||||
name: A
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: B
|
||||
)
|
||||
)
|
||||
1: Stmt_DeclareDeclare(
|
||||
key: C
|
||||
key: Identifier(
|
||||
name: C
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: D
|
||||
)
|
||||
@@ -42,13 +48,17 @@ array(
|
||||
2: Stmt_Declare(
|
||||
declares: array(
|
||||
0: Stmt_DeclareDeclare(
|
||||
key: A
|
||||
key: Identifier(
|
||||
name: A
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: B
|
||||
)
|
||||
)
|
||||
1: Stmt_DeclareDeclare(
|
||||
key: C
|
||||
key: Identifier(
|
||||
name: C
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: D
|
||||
)
|
||||
|
87
vendor/nikic/php-parser/test/code/parser/stmt/function/builtinTypeDeclarations.test
vendored
Normal file
87
vendor/nikic/php-parser/test/code/parser/stmt/function/builtinTypeDeclarations.test
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
Scalar type declarations
|
||||
-----
|
||||
<?php
|
||||
function test(bool $a, Int $b, FLOAT $c, StRiNg $d, iterable $e, object $f) : void {}
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: Identifier(
|
||||
name: test
|
||||
)
|
||||
params: array(
|
||||
0: Param(
|
||||
type: Identifier(
|
||||
name: bool
|
||||
)
|
||||
byRef: false
|
||||
variadic: false
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
default: null
|
||||
)
|
||||
1: Param(
|
||||
type: Identifier(
|
||||
name: int
|
||||
)
|
||||
byRef: false
|
||||
variadic: false
|
||||
var: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
default: null
|
||||
)
|
||||
2: Param(
|
||||
type: Identifier(
|
||||
name: float
|
||||
)
|
||||
byRef: false
|
||||
variadic: false
|
||||
var: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
default: null
|
||||
)
|
||||
3: Param(
|
||||
type: Identifier(
|
||||
name: string
|
||||
)
|
||||
byRef: false
|
||||
variadic: false
|
||||
var: Expr_Variable(
|
||||
name: d
|
||||
)
|
||||
default: null
|
||||
)
|
||||
4: Param(
|
||||
type: Identifier(
|
||||
name: iterable
|
||||
)
|
||||
byRef: false
|
||||
variadic: false
|
||||
var: Expr_Variable(
|
||||
name: e
|
||||
)
|
||||
default: null
|
||||
)
|
||||
5: Param(
|
||||
type: Identifier(
|
||||
name: object
|
||||
)
|
||||
byRef: false
|
||||
variadic: false
|
||||
var: Expr_Variable(
|
||||
name: f
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
returnType: Identifier(
|
||||
name: void
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
@@ -8,13 +8,17 @@ function &a($b) {}
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: a
|
||||
name: Identifier(
|
||||
name: a
|
||||
)
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: true
|
||||
variadic: false
|
||||
name: b
|
||||
var: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
@@ -24,13 +28,17 @@ array(
|
||||
)
|
||||
1: Stmt_Function(
|
||||
byRef: true
|
||||
name: a
|
||||
name: Identifier(
|
||||
name: a
|
||||
)
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: b
|
||||
var: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
@@ -38,4 +46,4 @@ array(
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -18,7 +18,9 @@ array(
|
||||
stmts: array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: A
|
||||
name: Identifier(
|
||||
name: A
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
@@ -30,4 +32,4 @@ array(
|
||||
)
|
||||
else: null
|
||||
)
|
||||
)
|
||||
)
|
@@ -17,13 +17,17 @@ function a(
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: a
|
||||
name: Identifier(
|
||||
name: a
|
||||
)
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: b
|
||||
var: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
default: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
@@ -36,7 +40,9 @@ array(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: c
|
||||
var: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
default: Scalar_String(
|
||||
value: foo
|
||||
)
|
||||
@@ -45,21 +51,27 @@ array(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: d
|
||||
var: Expr_Variable(
|
||||
name: d
|
||||
)
|
||||
default: Expr_ClassConstFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: B
|
||||
name: Identifier(
|
||||
name: B
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: f
|
||||
var: Expr_Variable(
|
||||
name: f
|
||||
)
|
||||
default: Expr_UnaryPlus(
|
||||
expr: Scalar_LNumber(
|
||||
value: 1
|
||||
@@ -70,7 +82,9 @@ array(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: g
|
||||
var: Expr_Variable(
|
||||
name: g
|
||||
)
|
||||
default: Expr_UnaryMinus(
|
||||
expr: Scalar_DNumber(
|
||||
value: 1
|
||||
@@ -81,7 +95,9 @@ array(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: h
|
||||
var: Expr_Variable(
|
||||
name: h
|
||||
)
|
||||
default: Expr_Array(
|
||||
items: array(
|
||||
)
|
||||
@@ -91,7 +107,9 @@ array(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: i
|
||||
var: Expr_Variable(
|
||||
name: i
|
||||
)
|
||||
default: Expr_Array(
|
||||
items: array(
|
||||
)
|
||||
@@ -101,7 +119,9 @@ array(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: j
|
||||
var: Expr_Variable(
|
||||
name: j
|
||||
)
|
||||
default: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
@@ -118,7 +138,9 @@ array(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: k
|
||||
var: Expr_Variable(
|
||||
name: k
|
||||
)
|
||||
default: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
@@ -145,4 +167,4 @@ array(
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
55
vendor/nikic/php-parser/test/code/parser/stmt/function/nullableTypes.test
vendored
Normal file
55
vendor/nikic/php-parser/test/code/parser/stmt/function/nullableTypes.test
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
Nullable types
|
||||
-----
|
||||
<?php
|
||||
|
||||
function test(?Foo $bar, ?string $foo) : ?Baz {
|
||||
}
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: Identifier(
|
||||
name: test
|
||||
)
|
||||
params: array(
|
||||
0: Param(
|
||||
type: NullableType(
|
||||
type: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
variadic: false
|
||||
var: Expr_Variable(
|
||||
name: bar
|
||||
)
|
||||
default: null
|
||||
)
|
||||
1: Param(
|
||||
type: NullableType(
|
||||
type: Identifier(
|
||||
name: string
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
variadic: false
|
||||
var: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
returnType: NullableType(
|
||||
type: Name(
|
||||
parts: array(
|
||||
0: Baz
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
@@ -10,7 +10,9 @@ function test4() : Foo\Bar {}
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: test1
|
||||
name: Identifier(
|
||||
name: test1
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
@@ -19,25 +21,35 @@ array(
|
||||
)
|
||||
1: Stmt_Function(
|
||||
byRef: false
|
||||
name: test2
|
||||
name: Identifier(
|
||||
name: test2
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: array
|
||||
returnType: Identifier(
|
||||
name: array
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
2: Stmt_Function(
|
||||
byRef: false
|
||||
name: test3
|
||||
name: Identifier(
|
||||
name: test3
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: callable
|
||||
returnType: Identifier(
|
||||
name: callable
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
3: Stmt_Function(
|
||||
byRef: false
|
||||
name: test4
|
||||
name: Identifier(
|
||||
name: test4
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: Name(
|
||||
@@ -49,4 +61,4 @@ array(
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -1,45 +0,0 @@
|
||||
Scalar type declarations
|
||||
-----
|
||||
<?php
|
||||
function test(bool $a, Int $b, FLOAT $c, StRiNg $d) {}
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: test
|
||||
params: array(
|
||||
0: Param(
|
||||
type: bool
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: a
|
||||
default: null
|
||||
)
|
||||
1: Param(
|
||||
type: int
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: b
|
||||
default: null
|
||||
)
|
||||
2: Param(
|
||||
type: float
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: c
|
||||
default: null
|
||||
)
|
||||
3: Param(
|
||||
type: string
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: d
|
||||
default: null
|
||||
)
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
@@ -10,7 +10,9 @@ function a() {
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: a
|
||||
name: Identifier(
|
||||
name: a
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
@@ -35,11 +37,15 @@ array(
|
||||
1: Stmt_Static(
|
||||
vars: array(
|
||||
0: Stmt_StaticVar(
|
||||
name: c
|
||||
var: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
default: null
|
||||
)
|
||||
1: Stmt_StaticVar(
|
||||
name: d
|
||||
var: Expr_Variable(
|
||||
name: d
|
||||
)
|
||||
default: Scalar_String(
|
||||
value: e
|
||||
)
|
||||
@@ -48,4 +54,4 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -7,27 +7,39 @@ function a($b, array $c, callable $d, E $f) {}
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: a
|
||||
name: Identifier(
|
||||
name: a
|
||||
)
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: b
|
||||
var: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
default: null
|
||||
)
|
||||
1: Param(
|
||||
type: array
|
||||
type: Identifier(
|
||||
name: array
|
||||
)
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: c
|
||||
var: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
default: null
|
||||
)
|
||||
2: Param(
|
||||
type: callable
|
||||
type: Identifier(
|
||||
name: callable
|
||||
)
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: d
|
||||
var: Expr_Variable(
|
||||
name: d
|
||||
)
|
||||
default: null
|
||||
)
|
||||
3: Param(
|
||||
@@ -38,7 +50,9 @@ array(
|
||||
)
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: f
|
||||
var: Expr_Variable(
|
||||
name: f
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
@@ -46,4 +60,4 @@ array(
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -9,20 +9,26 @@ function test($a, Type &... $b) {}
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: test
|
||||
name: Identifier(
|
||||
name: test
|
||||
)
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: a
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
default: null
|
||||
)
|
||||
1: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: true
|
||||
name: b
|
||||
var: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
@@ -32,20 +38,26 @@ array(
|
||||
)
|
||||
1: Stmt_Function(
|
||||
byRef: false
|
||||
name: test
|
||||
name: Identifier(
|
||||
name: test
|
||||
)
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: a
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
default: null
|
||||
)
|
||||
1: Param(
|
||||
type: null
|
||||
byRef: true
|
||||
variadic: true
|
||||
name: b
|
||||
var: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
@@ -55,13 +67,17 @@ array(
|
||||
)
|
||||
2: Stmt_Function(
|
||||
byRef: false
|
||||
name: test
|
||||
name: Identifier(
|
||||
name: test
|
||||
)
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: a
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
default: null
|
||||
)
|
||||
1: Param(
|
||||
@@ -72,7 +88,9 @@ array(
|
||||
)
|
||||
byRef: false
|
||||
variadic: true
|
||||
name: b
|
||||
var: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
@@ -82,13 +100,17 @@ array(
|
||||
)
|
||||
3: Stmt_Function(
|
||||
byRef: false
|
||||
name: test
|
||||
name: Identifier(
|
||||
name: test
|
||||
)
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: a
|
||||
var: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
default: null
|
||||
)
|
||||
1: Param(
|
||||
@@ -99,7 +121,9 @@ array(
|
||||
)
|
||||
byRef: true
|
||||
variadic: true
|
||||
name: b
|
||||
var: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
default: null
|
||||
)
|
||||
)
|
||||
@@ -107,4 +131,4 @@ array(
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -4,3 +4,28 @@ Invalid variadic function
|
||||
function foo(...$foo = []) {}
|
||||
-----
|
||||
Variadic parameter cannot have a default value from 2:24 to 2:25
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: Identifier(
|
||||
name: foo
|
||||
)
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: true
|
||||
var: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
default: Expr_Array(
|
||||
items: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
@@ -34,51 +34,26 @@ function gen() {
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: gen
|
||||
name: Identifier(
|
||||
name: gen
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
0: Expr_Yield(
|
||||
key: null
|
||||
value: null
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Yield(
|
||||
key: null
|
||||
value: null
|
||||
comments: array(
|
||||
0: // statements
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // statements
|
||||
)
|
||||
)
|
||||
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
|
||||
comments: array(
|
||||
0: // expressions
|
||||
)
|
||||
)
|
||||
expr: Expr_Yield(
|
||||
key: null
|
||||
value: null
|
||||
)
|
||||
comments: array(
|
||||
0: // expressions
|
||||
)
|
||||
)
|
||||
4: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
name: data
|
||||
)
|
||||
1: Stmt_Expression(
|
||||
expr: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
@@ -86,10 +61,7 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
name: data
|
||||
)
|
||||
2: Stmt_Expression(
|
||||
expr: Expr_Yield(
|
||||
key: Expr_Variable(
|
||||
name: key
|
||||
@@ -99,6 +71,54 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Stmt_Expression(
|
||||
expr: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
name: data
|
||||
comments: array(
|
||||
0: // expressions
|
||||
)
|
||||
)
|
||||
expr: Expr_Yield(
|
||||
key: null
|
||||
value: null
|
||||
)
|
||||
comments: array(
|
||||
0: // expressions
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // expressions
|
||||
)
|
||||
)
|
||||
4: Stmt_Expression(
|
||||
expr: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
name: data
|
||||
)
|
||||
expr: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: value
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Stmt_Expression(
|
||||
expr: Expr_Assign(
|
||||
var: Expr_Variable(
|
||||
name: data
|
||||
)
|
||||
expr: Expr_Yield(
|
||||
key: Expr_Variable(
|
||||
name: key
|
||||
)
|
||||
value: Expr_Variable(
|
||||
name: value
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
6: Stmt_If(
|
||||
cond: Expr_Yield(
|
||||
key: null
|
||||
@@ -159,14 +179,14 @@ array(
|
||||
)
|
||||
)
|
||||
9: Stmt_Do(
|
||||
stmts: array(
|
||||
)
|
||||
cond: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
10: Stmt_Switch(
|
||||
cond: Expr_Yield(
|
||||
@@ -178,100 +198,119 @@ array(
|
||||
cases: array(
|
||||
)
|
||||
)
|
||||
11: Expr_Exit(
|
||||
expr: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
11: Stmt_Expression(
|
||||
expr: Expr_Exit(
|
||||
expr: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
12: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: func
|
||||
12: Stmt_Expression(
|
||||
expr: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: func
|
||||
)
|
||||
comments: array(
|
||||
0: // yield in function calls
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // yield in function calls
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // yield in function calls
|
||||
)
|
||||
)
|
||||
13: Expr_MethodCall(
|
||||
var: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
name: func
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
13: Stmt_Expression(
|
||||
expr: Expr_MethodCall(
|
||||
var: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
name: Identifier(
|
||||
name: func
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
14: Expr_New(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
14: Stmt_Expression(
|
||||
expr: Expr_New(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
15: Expr_YieldFrom(
|
||||
expr: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
16: Expr_BinaryOp_LogicalAnd(
|
||||
left: Expr_YieldFrom(
|
||||
15: Stmt_Expression(
|
||||
expr: Expr_YieldFrom(
|
||||
expr: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
right: Expr_YieldFrom(
|
||||
expr: Expr_Variable(
|
||||
name: bar
|
||||
)
|
||||
16: Stmt_Expression(
|
||||
expr: Expr_BinaryOp_LogicalAnd(
|
||||
left: Expr_YieldFrom(
|
||||
expr: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
)
|
||||
right: Expr_YieldFrom(
|
||||
expr: Expr_Variable(
|
||||
name: bar
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
17: Expr_YieldFrom(
|
||||
expr: Expr_BinaryOp_Plus(
|
||||
left: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: bar
|
||||
17: Stmt_Expression(
|
||||
expr: Expr_YieldFrom(
|
||||
expr: Expr_BinaryOp_Plus(
|
||||
left: Expr_Variable(
|
||||
name: foo
|
||||
)
|
||||
right: Expr_Variable(
|
||||
name: bar
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@@ -18,154 +18,85 @@ function gen() {
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: gen
|
||||
name: Identifier(
|
||||
name: gen
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
0: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Expr_BinaryOp_LogicalOr(
|
||||
left: Expr_Yield(
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Yield(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
)
|
||||
right: Expr_Exit(
|
||||
expr: null
|
||||
)
|
||||
)
|
||||
2: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k
|
||||
)
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Expr_BinaryOp_LogicalOr(
|
||||
left: Expr_Yield(
|
||||
1: Stmt_Expression(
|
||||
expr: Expr_BinaryOp_LogicalOr(
|
||||
left: Expr_Yield(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
)
|
||||
right: Expr_Exit(
|
||||
expr: null
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_Expression(
|
||||
expr: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
)
|
||||
right: Expr_Exit(
|
||||
expr: null
|
||||
)
|
||||
)
|
||||
4: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: var_dump
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k
|
||||
)
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k1
|
||||
)
|
||||
value: Expr_Yield(
|
||||
3: Stmt_Expression(
|
||||
expr: Expr_BinaryOp_LogicalOr(
|
||||
left: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k2
|
||||
value: k
|
||||
)
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
6: Expr_Yield(
|
||||
key: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k1
|
||||
)
|
||||
value: Expr_Yield(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: k2
|
||||
value: a
|
||||
)
|
||||
)
|
||||
)
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
right: Expr_Exit(
|
||||
expr: null
|
||||
)
|
||||
)
|
||||
)
|
||||
7: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: var_dump
|
||||
4: Stmt_Expression(
|
||||
expr: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: var_dump
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k1
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k2
|
||||
value: k
|
||||
)
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
@@ -176,55 +107,144 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
8: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: var_dump
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k1
|
||||
)
|
||||
value: Expr_Yield(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: k2
|
||||
)
|
||||
)
|
||||
)
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
5: Stmt_Expression(
|
||||
expr: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k1
|
||||
)
|
||||
value: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k2
|
||||
)
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
6: Stmt_Expression(
|
||||
expr: Expr_Yield(
|
||||
key: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k1
|
||||
)
|
||||
value: Expr_Yield(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: k2
|
||||
)
|
||||
)
|
||||
)
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
7: Stmt_Expression(
|
||||
expr: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: var_dump
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k1
|
||||
)
|
||||
value: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k2
|
||||
)
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
8: Stmt_Expression(
|
||||
expr: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: var_dump
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: Expr_Yield(
|
||||
key: Scalar_String(
|
||||
value: k1
|
||||
)
|
||||
value: Expr_Yield(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: k2
|
||||
)
|
||||
)
|
||||
)
|
||||
value: Expr_BinaryOp_Concat(
|
||||
left: Scalar_String(
|
||||
value: a
|
||||
)
|
||||
right: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -11,38 +11,46 @@ function gen() {
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: gen
|
||||
name: Identifier(
|
||||
name: gen
|
||||
)
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
0: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_UnaryPlus(
|
||||
expr: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_UnaryMinus(
|
||||
expr: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Expr_BinaryOp_Mul(
|
||||
left: Expr_Yield(
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Yield(
|
||||
key: null
|
||||
value: null
|
||||
value: Expr_UnaryPlus(
|
||||
expr: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
right: Expr_UnaryMinus(
|
||||
expr: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
1: Stmt_Expression(
|
||||
expr: Expr_Yield(
|
||||
key: null
|
||||
value: Expr_UnaryMinus(
|
||||
expr: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_Expression(
|
||||
expr: Expr_BinaryOp_Mul(
|
||||
left: Expr_Yield(
|
||||
key: null
|
||||
value: null
|
||||
)
|
||||
right: Expr_UnaryMinus(
|
||||
expr: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -8,8 +8,10 @@ __halt_compiler()
|
||||
Hallo World!
|
||||
-----
|
||||
array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
1: Stmt_HaltCompiler(
|
||||
remaining: Hallo World!
|
||||
@@ -22,8 +24,10 @@ $a;
|
||||
__halt_compiler();Hallo World!
|
||||
-----
|
||||
array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
1: Stmt_HaltCompiler(
|
||||
remaining: Hallo World!
|
||||
@@ -44,8 +48,10 @@ array(
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@@ -3,4 +3,4 @@ Invalid __halt_compiler() syntax
|
||||
<?php
|
||||
__halt_compiler()
|
||||
-----
|
||||
__HALT_COMPILER must be followed by "();" on line 2
|
||||
__HALT_COMPILER must be followed by "();" on line 2
|
@@ -7,23 +7,25 @@ __halt_compiler();
|
||||
Foo
|
||||
-----
|
||||
array(
|
||||
0: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: var_dump
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: var_dump
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: __HALT_COMPILER_OFFSET__
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: __HALT_COMPILER_OFFSET__
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -31,4 +33,4 @@ array(
|
||||
remaining:
|
||||
Foo
|
||||
)
|
||||
)
|
||||
)
|
@@ -5,4 +5,4 @@ if (true) {
|
||||
__halt_compiler();
|
||||
}
|
||||
-----
|
||||
__HALT_COMPILER() can only be used from the outermost scope from 3:5 to 3:19
|
||||
__HALT_COMPILER() can only be used from the outermost scope from 3:5 to 3:19
|
@@ -23,4 +23,4 @@ array(
|
||||
2: Stmt_InlineHTML(
|
||||
value: #!/usr/bin/env php
|
||||
)
|
||||
)
|
||||
)
|
@@ -11,17 +11,23 @@ $c;
|
||||
$d;
|
||||
-----
|
||||
array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
)
|
||||
1: Stmt_InlineHTML(
|
||||
value: B
|
||||
|
||||
)
|
||||
2: Expr_Variable(
|
||||
name: c
|
||||
2: Stmt_Expression(
|
||||
expr: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
3: Expr_Variable(
|
||||
name: d
|
||||
3: Stmt_Expression(
|
||||
expr: Expr_Variable(
|
||||
name: d
|
||||
)
|
||||
)
|
||||
)
|
@@ -8,10 +8,10 @@ do {
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Do(
|
||||
stmts: array(
|
||||
)
|
||||
cond: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
@@ -80,12 +80,20 @@ array(
|
||||
keyVar: null
|
||||
byRef: false
|
||||
valueVar: Expr_List(
|
||||
vars: array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: b
|
||||
1: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -101,13 +109,21 @@ array(
|
||||
)
|
||||
byRef: false
|
||||
valueVar: Expr_List(
|
||||
vars: array(
|
||||
0: Expr_Variable(
|
||||
name: b
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: null
|
||||
2: Expr_Variable(
|
||||
name: c
|
||||
2: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
|
75
vendor/nikic/php-parser/test/code/parser/stmt/multiCatch.test
vendored
Normal file
75
vendor/nikic/php-parser/test/code/parser/stmt/multiCatch.test
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
Try/catch with multiple classes
|
||||
-----
|
||||
<?php
|
||||
try {
|
||||
$x;
|
||||
} catch (X|Y $e1) {
|
||||
$y;
|
||||
} catch (\A|B\C $e2) {
|
||||
$z;
|
||||
}
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Stmt_TryCatch(
|
||||
stmts: array(
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Variable(
|
||||
name: x
|
||||
)
|
||||
)
|
||||
)
|
||||
catches: array(
|
||||
0: Stmt_Catch(
|
||||
types: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: X
|
||||
)
|
||||
)
|
||||
1: Name(
|
||||
parts: array(
|
||||
0: Y
|
||||
)
|
||||
)
|
||||
)
|
||||
var: Expr_Variable(
|
||||
name: e1
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Variable(
|
||||
name: y
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Catch(
|
||||
types: array(
|
||||
0: Name_FullyQualified(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
1: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
1: C
|
||||
)
|
||||
)
|
||||
)
|
||||
var: Expr_Variable(
|
||||
name: e2
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_Variable(
|
||||
name: z
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
finally: null
|
||||
)
|
||||
)
|
@@ -18,70 +18,74 @@ use const foo\BAR as BAZ;
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Use(
|
||||
type: 1
|
||||
type: TYPE_NORMAL (1)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
)
|
||||
)
|
||||
alias: B
|
||||
alias: null
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Use(
|
||||
type: 1
|
||||
type: TYPE_NORMAL (1)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
1: D
|
||||
)
|
||||
)
|
||||
alias: E
|
||||
alias: Identifier(
|
||||
name: E
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_Use(
|
||||
type: 1
|
||||
type: TYPE_NORMAL (1)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: F
|
||||
1: G
|
||||
)
|
||||
)
|
||||
alias: H
|
||||
alias: Identifier(
|
||||
name: H
|
||||
)
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: J
|
||||
)
|
||||
)
|
||||
alias: J
|
||||
alias: null
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Stmt_Use(
|
||||
type: 1
|
||||
type: TYPE_NORMAL (1)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
alias: A
|
||||
alias: null
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
@@ -89,31 +93,33 @@ array(
|
||||
)
|
||||
)
|
||||
4: Stmt_Use(
|
||||
type: 1
|
||||
type: TYPE_NORMAL (1)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
alias: B
|
||||
alias: Identifier(
|
||||
name: B
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Stmt_Use(
|
||||
type: 2
|
||||
type: TYPE_FUNCTION (2)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
1: bar
|
||||
)
|
||||
)
|
||||
alias: bar
|
||||
alias: null
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
@@ -121,47 +127,51 @@ array(
|
||||
)
|
||||
)
|
||||
6: Stmt_Use(
|
||||
type: 2
|
||||
type: TYPE_FUNCTION (2)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
1: bar
|
||||
)
|
||||
)
|
||||
alias: baz
|
||||
alias: Identifier(
|
||||
name: baz
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
7: Stmt_Use(
|
||||
type: 3
|
||||
type: TYPE_CONSTANT (3)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
1: BAR
|
||||
)
|
||||
)
|
||||
alias: BAR
|
||||
alias: null
|
||||
)
|
||||
)
|
||||
)
|
||||
8: Stmt_Use(
|
||||
type: 3
|
||||
type: TYPE_CONSTANT (3)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
1: BAR
|
||||
)
|
||||
)
|
||||
alias: BAZ
|
||||
alias: Identifier(
|
||||
name: BAZ
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@@ -18,10 +18,12 @@ array(
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -30,10 +32,12 @@ array(
|
||||
1: Stmt_Namespace(
|
||||
name: null
|
||||
stmts: array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: bar
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: bar
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
22
vendor/nikic/php-parser/test/code/parser/stmt/namespace/commentAfterNamespace.test
vendored
Normal file
22
vendor/nikic/php-parser/test/code/parser/stmt/namespace/commentAfterNamespace.test
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Trailing comment after braced namespace declaration
|
||||
-----
|
||||
<?php
|
||||
namespace Foo {}
|
||||
// Comment
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_Nop(
|
||||
comments: array(
|
||||
0: // Comment
|
||||
)
|
||||
)
|
||||
)
|
@@ -10,7 +10,7 @@ use A\B\{C\D, function b\c, const D};
|
||||
-----
|
||||
array(
|
||||
0: Stmt_GroupUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
@@ -18,18 +18,18 @@ array(
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 1
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
alias: B
|
||||
alias: null
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_GroupUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
@@ -37,28 +37,28 @@ array(
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 1
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
1: C
|
||||
)
|
||||
)
|
||||
alias: C
|
||||
alias: null
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: 1
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: D
|
||||
)
|
||||
)
|
||||
alias: D
|
||||
alias: null
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_GroupUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
@@ -67,28 +67,28 @@ array(
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 1
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
1: D
|
||||
)
|
||||
)
|
||||
alias: D
|
||||
alias: null
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: 1
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
alias: E
|
||||
alias: null
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Stmt_GroupUse(
|
||||
type: 2
|
||||
type: TYPE_FUNCTION (2)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
@@ -96,28 +96,28 @@ array(
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: b
|
||||
1: c
|
||||
)
|
||||
)
|
||||
alias: c
|
||||
alias: null
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: d
|
||||
)
|
||||
)
|
||||
alias: d
|
||||
alias: null
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Stmt_GroupUse(
|
||||
type: 3
|
||||
type: TYPE_CONSTANT (3)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
@@ -125,28 +125,28 @@ array(
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
1: C
|
||||
)
|
||||
)
|
||||
alias: C
|
||||
alias: null
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: D
|
||||
)
|
||||
)
|
||||
alias: D
|
||||
alias: null
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Stmt_GroupUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
@@ -155,34 +155,34 @@ array(
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 1
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
1: D
|
||||
)
|
||||
)
|
||||
alias: D
|
||||
alias: null
|
||||
)
|
||||
1: Stmt_UseUse(
|
||||
type: 2
|
||||
type: TYPE_FUNCTION (2)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: b
|
||||
1: c
|
||||
)
|
||||
)
|
||||
alias: c
|
||||
alias: null
|
||||
)
|
||||
2: Stmt_UseUse(
|
||||
type: 3
|
||||
type: TYPE_CONSTANT (3)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: D
|
||||
)
|
||||
)
|
||||
alias: D
|
||||
alias: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -5,10 +5,33 @@ Invalid group use syntax
|
||||
use Foo\{Bar}
|
||||
use Bar\{Foo};
|
||||
-----
|
||||
!!php7
|
||||
Syntax error, unexpected T_USE, expecting ';' from 4:1 to 4:3
|
||||
array(
|
||||
0: Stmt_GroupUse(
|
||||
type: 0
|
||||
type: TYPE_UNKNOWN (0)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Bar
|
||||
)
|
||||
)
|
||||
alias: null
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // Missing semicolon
|
||||
)
|
||||
)
|
||||
1: Stmt_GroupUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: Bar
|
||||
@@ -16,13 +39,13 @@ array(
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: 1
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
alias: Foo
|
||||
alias: null
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -32,19 +55,41 @@ array(
|
||||
// Missing NS separator
|
||||
use Foo {Bar, Baz};
|
||||
-----
|
||||
Syntax error, unexpected '{', expecting ',' or ';' from 3:9 to 3:9
|
||||
!!php7
|
||||
Syntax error, unexpected '{', expecting ';' from 3:9 to 3:9
|
||||
array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Bar
|
||||
0: Stmt_Use(
|
||||
type: TYPE_NORMAL (1)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
alias: null
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // Missing NS separator
|
||||
)
|
||||
)
|
||||
1: Stmt_Expression(
|
||||
expr: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Bar
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Baz
|
||||
2: Stmt_Expression(
|
||||
expr: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: Baz
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -56,10 +101,12 @@ use Foo\{\Bar};
|
||||
-----
|
||||
Syntax error, unexpected T_NS_SEPARATOR, expecting T_STRING or T_FUNCTION or T_CONST from 3:10 to 3:10
|
||||
array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name_FullyQualified(
|
||||
parts: array(
|
||||
0: Bar
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_ConstFetch(
|
||||
name: Name_FullyQualified(
|
||||
parts: array(
|
||||
0: Bar
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
28
vendor/nikic/php-parser/test/code/parser/stmt/namespace/groupUsePositions.test
vendored
Normal file
28
vendor/nikic/php-parser/test/code/parser/stmt/namespace/groupUsePositions.test
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
Ensure correct file position attributes for group use prefix
|
||||
-----
|
||||
<?php
|
||||
use Foo\Bar\{Baz};
|
||||
-----
|
||||
!!positions
|
||||
array(
|
||||
0: Stmt_GroupUse[2:1 - 2:17](
|
||||
type: TYPE_UNKNOWN (0)
|
||||
prefix: Name[2:5 - 2:11](
|
||||
parts: array(
|
||||
0: Foo
|
||||
1: Bar
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse[2:14 - 2:16](
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name[2:14 - 2:16](
|
||||
parts: array(
|
||||
0: Baz
|
||||
)
|
||||
)
|
||||
alias: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
47
vendor/nikic/php-parser/test/code/parser/stmt/namespace/groupUseTrailingComma.test
vendored
Normal file
47
vendor/nikic/php-parser/test/code/parser/stmt/namespace/groupUseTrailingComma.test
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
Group use can have trailing comma
|
||||
-----
|
||||
<?php
|
||||
use A\{B,};
|
||||
use function A\{b,};
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Stmt_GroupUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_NORMAL (1)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
alias: null
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_GroupUse(
|
||||
type: TYPE_FUNCTION (2)
|
||||
prefix: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: b
|
||||
)
|
||||
)
|
||||
alias: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -3,10 +3,32 @@ Invalid namespace names
|
||||
<?php namespace self;
|
||||
-----
|
||||
Cannot use 'self' as namespace name from 1:17 to 1:20
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: self
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php namespace PARENT;
|
||||
-----
|
||||
Cannot use 'PARENT' as namespace name from 1:17 to 1:22
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: PARENT
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php namespace static;
|
||||
-----
|
||||
@@ -16,14 +38,50 @@ array(
|
||||
-----
|
||||
<?php use A as self;
|
||||
-----
|
||||
Cannot use A as self because 'self' is a special class name on line 1
|
||||
Cannot use A as self because 'self' is a special class name from 1:16 to 1:19
|
||||
array(
|
||||
0: Stmt_Use(
|
||||
type: TYPE_NORMAL (1)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
alias: Identifier(
|
||||
name: self
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php use B as PARENT;
|
||||
-----
|
||||
Cannot use B as PARENT because 'PARENT' is a special class name on line 1
|
||||
Cannot use B as PARENT because 'PARENT' is a special class name from 1:16 to 1:21
|
||||
array(
|
||||
0: Stmt_Use(
|
||||
type: TYPE_NORMAL (1)
|
||||
uses: array(
|
||||
0: Stmt_UseUse(
|
||||
type: TYPE_UNKNOWN (0)
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
alias: Identifier(
|
||||
name: PARENT
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php use C as static;
|
||||
-----
|
||||
Syntax error, unexpected T_STATIC, expecting T_STRING from 1:16 to 1:21
|
||||
array(
|
||||
)
|
||||
)
|
@@ -2,12 +2,102 @@ Namespace types cannot be mixed
|
||||
-----
|
||||
<?php
|
||||
namespace A;
|
||||
namespace B {}
|
||||
echo 1;
|
||||
namespace B {
|
||||
echo 2;
|
||||
}
|
||||
echo 3;
|
||||
-----
|
||||
Cannot mix bracketed namespace declarations with unbracketed namespace declarations on line 3
|
||||
Cannot mix bracketed namespace declarations with unbracketed namespace declarations on line 4
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Echo(
|
||||
exprs: array(
|
||||
0: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Echo(
|
||||
exprs: array(
|
||||
0: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_Echo(
|
||||
exprs: array(
|
||||
0: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
namespace A {}
|
||||
namespace A {
|
||||
echo 1;
|
||||
}
|
||||
echo 2;
|
||||
namespace B;
|
||||
echo 3;
|
||||
-----
|
||||
Cannot mix bracketed namespace declarations with unbracketed namespace declarations on line 3
|
||||
Cannot mix bracketed namespace declarations with unbracketed namespace declarations on line 6
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Echo(
|
||||
exprs: array(
|
||||
0: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Echo(
|
||||
exprs: array(
|
||||
0: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Echo(
|
||||
exprs: array(
|
||||
0: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -8,34 +8,42 @@ A\B;
|
||||
namespace\A\B;
|
||||
-----
|
||||
array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
1: Stmt_Expression(
|
||||
expr: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Expr_ConstFetch(
|
||||
name: Name_FullyQualified(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
2: Stmt_Expression(
|
||||
expr: Expr_ConstFetch(
|
||||
name: Name_FullyQualified(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Expr_ConstFetch(
|
||||
name: Name_Relative(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
3: Stmt_Expression(
|
||||
expr: Expr_ConstFetch(
|
||||
name: Name_Relative(
|
||||
parts: array(
|
||||
0: A
|
||||
1: B
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@@ -8,3 +8,23 @@ namespace A {
|
||||
}
|
||||
-----
|
||||
Namespace declarations cannot be nested from 3:5 to 5:5
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
@@ -17,10 +17,12 @@ array(
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -33,10 +35,12 @@ array(
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: bar
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: bar
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@@ -13,7 +13,9 @@ array(
|
||||
0: Stmt_Declare(
|
||||
declares: array(
|
||||
0: Stmt_DeclareDeclare(
|
||||
key: A
|
||||
key: Identifier(
|
||||
name: A
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: B
|
||||
)
|
||||
|
@@ -2,19 +2,108 @@ There (mostly) can't be statements outside of namespaces
|
||||
-----
|
||||
<?php
|
||||
echo 1;
|
||||
echo 2;
|
||||
namespace A;
|
||||
-----
|
||||
Namespace declaration statement has to be the very first statement in the script on line 3
|
||||
Namespace declaration statement has to be the very first statement in the script on line 4
|
||||
array(
|
||||
0: Stmt_Echo(
|
||||
exprs: array(
|
||||
0: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Echo(
|
||||
exprs: array(
|
||||
0: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
namespace A {}
|
||||
echo 1;
|
||||
-----
|
||||
No code may exist outside of namespace {} on line 3
|
||||
No code may exist outside of namespace {} from 3:1 to 3:7
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_Echo(
|
||||
exprs: array(
|
||||
0: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php
|
||||
namespace A {}
|
||||
declare(ticks=1);
|
||||
foo();
|
||||
namespace B {}
|
||||
-----
|
||||
No code may exist outside of namespace {} on line 3
|
||||
No code may exist outside of namespace {} from 3:1 to 3:17
|
||||
array(
|
||||
0: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_Declare(
|
||||
declares: array(
|
||||
0: Stmt_DeclareDeclare(
|
||||
key: Identifier(
|
||||
name: ticks
|
||||
)
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: null
|
||||
)
|
||||
2: Stmt_Expression(
|
||||
expr: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Stmt_Namespace(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
@@ -4,6 +4,8 @@ Switch
|
||||
|
||||
switch ($a) {
|
||||
case 0:
|
||||
break;
|
||||
// Comment
|
||||
case 1;
|
||||
default:
|
||||
}
|
||||
@@ -27,6 +29,9 @@ array(
|
||||
value: 0
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Break(
|
||||
num: null
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Case(
|
||||
@@ -35,6 +40,9 @@ array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
comments: array(
|
||||
0: // Comment
|
||||
)
|
||||
)
|
||||
2: Stmt_Case(
|
||||
cond: null
|
||||
|
@@ -24,65 +24,83 @@ finally { }
|
||||
array(
|
||||
0: Stmt_TryCatch(
|
||||
stmts: array(
|
||||
0: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: doTry
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: doTry
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
catches: array(
|
||||
0: Stmt_Catch(
|
||||
type: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
types: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
)
|
||||
var: b
|
||||
var: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: doCatchA
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: doCatchA
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Catch(
|
||||
type: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
types: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
)
|
||||
var: c
|
||||
var: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
stmts: array(
|
||||
0: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: doCatchB
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: doCatchB
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
finallyStmts: array(
|
||||
0: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: doFinally
|
||||
finally: Stmt_Finally(
|
||||
stmts: array(
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: doFinally
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -91,17 +109,21 @@ array(
|
||||
)
|
||||
catches: array(
|
||||
0: Stmt_Catch(
|
||||
type: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
types: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
)
|
||||
var: b
|
||||
var: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
finallyStmts: null
|
||||
finally: null
|
||||
comments: array(
|
||||
0: // no finally
|
||||
)
|
||||
@@ -111,7 +133,9 @@ array(
|
||||
)
|
||||
catches: array(
|
||||
)
|
||||
finallyStmts: array(
|
||||
finally: Stmt_Finally(
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
comments: array(
|
||||
0: // no catch
|
||||
|
@@ -2,6 +2,28 @@ Cannot use try without catch or finally
|
||||
-----
|
||||
<?php
|
||||
|
||||
try { }
|
||||
try {
|
||||
foo();
|
||||
}
|
||||
-----
|
||||
Cannot use try without catch or finally on line 3
|
||||
Cannot use try without catch or finally from 3:1 to 5:1
|
||||
array(
|
||||
0: Stmt_TryCatch(
|
||||
stmts: array(
|
||||
0: Stmt_Expression(
|
||||
expr: Expr_FuncCall(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: foo
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
catches: array(
|
||||
)
|
||||
finally: null
|
||||
)
|
||||
)
|
Reference in New Issue
Block a user