First commit
This commit is contained in:
commit
c6e2478c40
13918 changed files with 2303184 additions and 0 deletions
39
vendor/nikic/php-parser/test/code/parser/stmt/class/abstract.test
vendored
Normal file
39
vendor/nikic/php-parser/test/code/parser/stmt/class/abstract.test
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
Abstract class
|
||||
-----
|
||||
<?php
|
||||
|
||||
abstract class A {
|
||||
public function a() {}
|
||||
abstract public function b();
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: MODIFIER_ABSTRACT (16)
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
byRef: false
|
||||
name: a
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_ClassMethod(
|
||||
flags: MODIFIER_PUBLIC | MODIFIER_ABSTRACT (17)
|
||||
byRef: false
|
||||
name: b
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
195
vendor/nikic/php-parser/test/code/parser/stmt/class/anonymous.test
vendored
Normal file
195
vendor/nikic/php-parser/test/code/parser/stmt/class/anonymous.test
vendored
Normal file
|
@ -0,0 +1,195 @@
|
|||
Anonymous classes
|
||||
-----
|
||||
<?php
|
||||
|
||||
new class {
|
||||
public function test() {}
|
||||
};
|
||||
new class extends A implements B, C {};
|
||||
new class() {
|
||||
public $foo;
|
||||
};
|
||||
new class($a, $b) extends A {
|
||||
use T;
|
||||
};
|
||||
|
||||
class A {
|
||||
public function test() {
|
||||
return new class($this) extends A {
|
||||
const A = 'B';
|
||||
};
|
||||
}
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Expr_New(
|
||||
class: Stmt_Class(
|
||||
flags: 0
|
||||
name: null
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
byRef: false
|
||||
name: test
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
1: 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(
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
2: 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: foo
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
)
|
||||
)
|
||||
3: 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
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
1: Arg(
|
||||
value: Expr_Variable(
|
||||
name: b
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
byRef: false
|
||||
name: test
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
0: Stmt_Return(
|
||||
expr: Expr_New(
|
||||
class: Stmt_Class(
|
||||
flags: 0
|
||||
name: null
|
||||
extends: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassConst(
|
||||
flags: 0
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: A
|
||||
value: Scalar_String(
|
||||
value: B
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
args: array(
|
||||
0: Arg(
|
||||
value: Expr_Variable(
|
||||
name: this
|
||||
)
|
||||
byRef: false
|
||||
unpack: false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
33
vendor/nikic/php-parser/test/code/parser/stmt/class/conditional.test
vendored
Normal file
33
vendor/nikic/php-parser/test/code/parser/stmt/class/conditional.test
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
Conditional class definition
|
||||
-----
|
||||
<?php
|
||||
|
||||
if (true) {
|
||||
class A {}
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_If(
|
||||
cond: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: true
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
elseifs: array(
|
||||
)
|
||||
else: null
|
||||
)
|
||||
)
|
121
vendor/nikic/php-parser/test/code/parser/stmt/class/constModifierErrors.test
vendored
Normal file
121
vendor/nikic/php-parser/test/code/parser/stmt/class/constModifierErrors.test
vendored
Normal file
|
@ -0,0 +1,121 @@
|
|||
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: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassConst(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
consts: array(
|
||||
0: Const(
|
||||
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: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassConst(
|
||||
flags: MODIFIER_ABSTRACT (16)
|
||||
consts: array(
|
||||
0: Const(
|
||||
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: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassConst(
|
||||
flags: MODIFIER_FINAL (32)
|
||||
consts: array(
|
||||
0: Const(
|
||||
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: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassConst(
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: X
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
67
vendor/nikic/php-parser/test/code/parser/stmt/class/constModifiers.test
vendored
Normal file
67
vendor/nikic/php-parser/test/code/parser/stmt/class/constModifiers.test
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
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: Foo
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassConst(
|
||||
flags: 0
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: A
|
||||
value: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_ClassConst(
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: B
|
||||
value: Scalar_LNumber(
|
||||
value: 2
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_ClassConst(
|
||||
flags: MODIFIER_PROTECTED (2)
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: C
|
||||
value: Scalar_LNumber(
|
||||
value: 3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Stmt_ClassConst(
|
||||
flags: MODIFIER_PRIVATE (4)
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: D
|
||||
value: Scalar_LNumber(
|
||||
value: 4
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
17
vendor/nikic/php-parser/test/code/parser/stmt/class/final.test
vendored
Normal file
17
vendor/nikic/php-parser/test/code/parser/stmt/class/final.test
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
Final class
|
||||
-----
|
||||
<?php
|
||||
|
||||
final class A {}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: MODIFIER_FINAL (32)
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
92
vendor/nikic/php-parser/test/code/parser/stmt/class/implicitPublic.test
vendored
Normal file
92
vendor/nikic/php-parser/test/code/parser/stmt/class/implicitPublic.test
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
Implicitly public properties and methods
|
||||
-----
|
||||
<?php
|
||||
|
||||
abstract class A {
|
||||
var $a;
|
||||
static $b;
|
||||
abstract function c();
|
||||
final function d() {}
|
||||
static function e() {}
|
||||
final static function f() {}
|
||||
function g() {}
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: MODIFIER_ABSTRACT (16)
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
flags: 0
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: a
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Property(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: b
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_ClassMethod(
|
||||
flags: MODIFIER_ABSTRACT (16)
|
||||
byRef: false
|
||||
name: c
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: null
|
||||
)
|
||||
3: Stmt_ClassMethod(
|
||||
flags: MODIFIER_FINAL (32)
|
||||
byRef: false
|
||||
name: d
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
4: Stmt_ClassMethod(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
byRef: false
|
||||
name: e
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
5: Stmt_ClassMethod(
|
||||
flags: MODIFIER_STATIC | MODIFIER_FINAL (40)
|
||||
byRef: false
|
||||
name: f
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
6: Stmt_ClassMethod(
|
||||
flags: 0
|
||||
byRef: false
|
||||
name: g
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
36
vendor/nikic/php-parser/test/code/parser/stmt/class/interface.test
vendored
Normal file
36
vendor/nikic/php-parser/test/code/parser/stmt/class/interface.test
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
Interface
|
||||
-----
|
||||
<?php
|
||||
|
||||
interface A extends C, D {
|
||||
public function a();
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Interface(
|
||||
name: A
|
||||
extends: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
)
|
||||
)
|
||||
1: Name(
|
||||
parts: array(
|
||||
0: D
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
byRef: false
|
||||
name: a
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
215
vendor/nikic/php-parser/test/code/parser/stmt/class/modifier.test
vendored
Normal file
215
vendor/nikic/php-parser/test/code/parser/stmt/class/modifier.test
vendored
Normal file
|
@ -0,0 +1,215 @@
|
|||
Invalid modifier combination
|
||||
-----
|
||||
<?php class A { public public $a; }
|
||||
-----
|
||||
Multiple access type modifiers are not allowed from 1:24 to 1:29
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: a
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { public protected $a; }
|
||||
-----
|
||||
Multiple access type modifiers are not allowed from 1:24 to 1:32
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
flags: MODIFIER_PUBLIC | MODIFIER_PROTECTED (3)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: a
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { abstract abstract function a(); }
|
||||
-----
|
||||
Multiple abstract modifiers are not allowed from 1:26 to 1:33
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_ABSTRACT (16)
|
||||
byRef: false
|
||||
name: a
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { static static $a; }
|
||||
-----
|
||||
Multiple static modifiers are not allowed from 1:24 to 1:29
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: a
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { final final function a() {} }
|
||||
-----
|
||||
Multiple final modifiers are not allowed from 1:23 to 1:27
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_FINAL (32)
|
||||
byRef: false
|
||||
name: a
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { abstract final function a(); }
|
||||
-----
|
||||
Cannot use the final modifier on an abstract class member from 1:26 to 1:30
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_ABSTRACT | MODIFIER_FINAL (48)
|
||||
byRef: false
|
||||
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
|
||||
-----
|
||||
Syntax error, unexpected T_FINAL, expecting T_CLASS from 1:16 to 1:20
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: MODIFIER_FINAL (32)
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_Nop(
|
||||
comments: array(
|
||||
0: // Type in the partial parse could conceivably be any of 0, 16 or 32
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { abstract $a; }
|
||||
-----
|
||||
Properties cannot be declared abstract from 1:17 to 1:24
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
flags: MODIFIER_ABSTRACT (16)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: a
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { final $a; }
|
||||
-----
|
||||
Properties cannot be declared final from 1:17 to 1:21
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
flags: MODIFIER_FINAL (32)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: a
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
240
vendor/nikic/php-parser/test/code/parser/stmt/class/name.test
vendored
Normal file
240
vendor/nikic/php-parser/test/code/parser/stmt/class/name.test
vendored
Normal file
|
@ -0,0 +1,240 @@
|
|||
Invalid class name
|
||||
-----
|
||||
<?php class self {}
|
||||
-----
|
||||
Cannot use 'self' as class name as it is reserved from 1:13 to 1:16
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: self
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class PARENT {}
|
||||
-----
|
||||
Cannot use 'PARENT' as class name as it is reserved from 1:13 to 1:18
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: PARENT
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class static {}
|
||||
-----
|
||||
Syntax error, unexpected T_STATIC, expecting T_STRING from 1:13 to 1:18
|
||||
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: 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: A
|
||||
extends: Name(
|
||||
parts: array(
|
||||
0: PARENT
|
||||
)
|
||||
)
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A extends static {}
|
||||
-----
|
||||
Cannot use 'static' as class name as it is reserved from 1:23 to 1:28
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
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: 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: A
|
||||
extends: null
|
||||
implements: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: PARENT
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A implements static {}
|
||||
-----
|
||||
Cannot use 'static' as interface name as it is reserved from 1:26 to 1:31
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
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 from 1:17 to 1:20
|
||||
array(
|
||||
0: Stmt_Interface(
|
||||
name: self
|
||||
extends: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php interface PARENT {}
|
||||
-----
|
||||
Cannot use 'PARENT' as class name as it is reserved from 1:17 to 1:22
|
||||
array(
|
||||
0: Stmt_Interface(
|
||||
name: PARENT
|
||||
extends: array(
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php interface static {}
|
||||
-----
|
||||
Syntax error, unexpected T_STATIC, expecting T_STRING from 1:17 to 1:22
|
||||
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: 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: A
|
||||
extends: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: PARENT
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php interface A extends static {}
|
||||
-----
|
||||
Cannot use 'static' as interface name as it is reserved from 1:27 to 1:32
|
||||
array(
|
||||
0: Stmt_Interface(
|
||||
name: A
|
||||
extends: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: static
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
50
vendor/nikic/php-parser/test/code/parser/stmt/class/php4Style.test
vendored
Normal file
50
vendor/nikic/php-parser/test/code/parser/stmt/class/php4Style.test
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
PHP 4 style declarations
|
||||
-----
|
||||
<?php
|
||||
|
||||
class A {
|
||||
var $foo;
|
||||
function bar() {}
|
||||
static abstract function baz() {}
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Property(
|
||||
flags: 0
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: foo
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_ClassMethod(
|
||||
flags: 0
|
||||
byRef: false
|
||||
name: bar
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
2: Stmt_ClassMethod(
|
||||
flags: MODIFIER_ABSTRACT | MODIFIER_STATIC (24)
|
||||
byRef: false
|
||||
name: baz
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
156
vendor/nikic/php-parser/test/code/parser/stmt/class/simple.test
vendored
Normal file
156
vendor/nikic/php-parser/test/code/parser/stmt/class/simple.test
vendored
Normal file
|
@ -0,0 +1,156 @@
|
|||
Class declaration
|
||||
-----
|
||||
<?php
|
||||
|
||||
class A extends B implements C, D {
|
||||
const A = 'B', C = 'D';
|
||||
|
||||
public $a = 'b', $c = 'd';
|
||||
protected $e;
|
||||
private $f;
|
||||
|
||||
public function a() {}
|
||||
public static function b($a) {}
|
||||
public final function c() : B {}
|
||||
protected function d() {}
|
||||
private function e() {}
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
implements: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
)
|
||||
)
|
||||
1: Name(
|
||||
parts: array(
|
||||
0: D
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassConst(
|
||||
flags: 0
|
||||
consts: array(
|
||||
0: Const(
|
||||
name: A
|
||||
value: Scalar_String(
|
||||
value: B
|
||||
)
|
||||
)
|
||||
1: Const(
|
||||
name: C
|
||||
value: Scalar_String(
|
||||
value: D
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Property(
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: a
|
||||
default: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
1: Stmt_PropertyProperty(
|
||||
name: c
|
||||
default: Scalar_String(
|
||||
value: d
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_Property(
|
||||
flags: MODIFIER_PROTECTED (2)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: e
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Stmt_Property(
|
||||
flags: MODIFIER_PRIVATE (4)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: f
|
||||
default: null
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Stmt_ClassMethod(
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
byRef: false
|
||||
name: a
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
5: Stmt_ClassMethod(
|
||||
flags: MODIFIER_PUBLIC | MODIFIER_STATIC (9)
|
||||
byRef: false
|
||||
name: b
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: a
|
||||
default: null
|
||||
)
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
6: Stmt_ClassMethod(
|
||||
flags: MODIFIER_PUBLIC | MODIFIER_FINAL (33)
|
||||
byRef: false
|
||||
name: c
|
||||
params: array(
|
||||
)
|
||||
returnType: Name(
|
||||
parts: array(
|
||||
0: B
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
7: Stmt_ClassMethod(
|
||||
flags: MODIFIER_PROTECTED (2)
|
||||
byRef: false
|
||||
name: d
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
8: Stmt_ClassMethod(
|
||||
flags: MODIFIER_PRIVATE (4)
|
||||
byRef: false
|
||||
name: e
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
151
vendor/nikic/php-parser/test/code/parser/stmt/class/staticMethod.test
vendored
Normal file
151
vendor/nikic/php-parser/test/code/parser/stmt/class/staticMethod.test
vendored
Normal file
|
@ -0,0 +1,151 @@
|
|||
Some special methods cannot be static
|
||||
-----
|
||||
<?php class A { static function __construct() {} }
|
||||
-----
|
||||
Constructor __construct() cannot be static from 1:17 to 1:22
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
byRef: false
|
||||
name: __construct
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { static function __destruct() {} }
|
||||
-----
|
||||
Destructor __destruct() cannot be static from 1:17 to 1:22
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
byRef: false
|
||||
name: __destruct
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { static function __clone() {} }
|
||||
-----
|
||||
Clone method __clone() cannot be static from 1:17 to 1:22
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
byRef: false
|
||||
name: __clone
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { static function __CONSTRUCT() {} }
|
||||
-----
|
||||
Constructor __CONSTRUCT() cannot be static from 1:17 to 1:22
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
byRef: false
|
||||
name: __CONSTRUCT
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { static function __Destruct() {} }
|
||||
-----
|
||||
Destructor __Destruct() cannot be static from 1:17 to 1:22
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
byRef: false
|
||||
name: __Destruct
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
-----
|
||||
<?php class A { static function __cLoNe() {} }
|
||||
-----
|
||||
Clone method __cLoNe() cannot be static from 1:17 to 1:22
|
||||
array(
|
||||
0: Stmt_Class(
|
||||
flags: 0
|
||||
name: A
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_STATIC (8)
|
||||
byRef: false
|
||||
name: __cLoNe
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
160
vendor/nikic/php-parser/test/code/parser/stmt/class/trait.test
vendored
Normal file
160
vendor/nikic/php-parser/test/code/parser/stmt/class/trait.test
vendored
Normal file
|
@ -0,0 +1,160 @@
|
|||
Traits
|
||||
-----
|
||||
<?php
|
||||
|
||||
trait A {
|
||||
public function a() {}
|
||||
}
|
||||
|
||||
class B {
|
||||
use C;
|
||||
use D {
|
||||
a as protected b;
|
||||
c as d;
|
||||
e as private;
|
||||
}
|
||||
use E, F, G {
|
||||
E::a insteadof F, G;
|
||||
E::b as protected c;
|
||||
E::d as e;
|
||||
E::f as private;
|
||||
}
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Trait(
|
||||
name: A
|
||||
stmts: array(
|
||||
0: Stmt_ClassMethod(
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
byRef: false
|
||||
name: a
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Class(
|
||||
flags: 0
|
||||
name: B
|
||||
extends: null
|
||||
implements: array(
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_TraitUse(
|
||||
traits: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: C
|
||||
)
|
||||
)
|
||||
)
|
||||
adaptations: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_TraitUse(
|
||||
traits: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: D
|
||||
)
|
||||
)
|
||||
)
|
||||
adaptations: array(
|
||||
0: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: null
|
||||
method: a
|
||||
newModifier: MODIFIER_PROTECTED (2)
|
||||
newName: b
|
||||
)
|
||||
1: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: null
|
||||
method: c
|
||||
newModifier: null
|
||||
newName: d
|
||||
)
|
||||
2: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: null
|
||||
method: e
|
||||
newModifier: MODIFIER_PRIVATE (4)
|
||||
newName: null
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_TraitUse(
|
||||
traits: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
1: Name(
|
||||
parts: array(
|
||||
0: F
|
||||
)
|
||||
)
|
||||
2: Name(
|
||||
parts: array(
|
||||
0: G
|
||||
)
|
||||
)
|
||||
)
|
||||
adaptations: array(
|
||||
0: Stmt_TraitUseAdaptation_Precedence(
|
||||
trait: Name(
|
||||
parts: array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
method: a
|
||||
insteadof: array(
|
||||
0: Name(
|
||||
parts: array(
|
||||
0: F
|
||||
)
|
||||
)
|
||||
1: Name(
|
||||
parts: array(
|
||||
0: G
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: Name(
|
||||
parts: array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
method: b
|
||||
newModifier: MODIFIER_PROTECTED (2)
|
||||
newName: c
|
||||
)
|
||||
2: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: Name(
|
||||
parts: array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
method: d
|
||||
newModifier: null
|
||||
newName: e
|
||||
)
|
||||
3: Stmt_TraitUseAdaptation_Alias(
|
||||
trait: Name(
|
||||
parts: array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
method: f
|
||||
newModifier: MODIFIER_PRIVATE (4)
|
||||
newName: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue