First commit
This commit is contained in:
commit
c6e2478c40
13918 changed files with 2303184 additions and 0 deletions
59
vendor/nikic/php-parser/test/code/parser/stmt/function/builtinTypeDeclarations.test
vendored
Normal file
59
vendor/nikic/php-parser/test/code/parser/stmt/function/builtinTypeDeclarations.test
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
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: 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
|
||||
)
|
||||
4: Param(
|
||||
type: iterable
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: e
|
||||
default: null
|
||||
)
|
||||
5: Param(
|
||||
type: object
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: f
|
||||
default: null
|
||||
)
|
||||
)
|
||||
returnType: void
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
41
vendor/nikic/php-parser/test/code/parser/stmt/function/byRef.test
vendored
Normal file
41
vendor/nikic/php-parser/test/code/parser/stmt/function/byRef.test
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
Return and pass by ref
|
||||
-----
|
||||
<?php
|
||||
|
||||
function a(&$b) {}
|
||||
function &a($b) {}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: a
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: true
|
||||
variadic: false
|
||||
name: b
|
||||
default: null
|
||||
)
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_Function(
|
||||
byRef: true
|
||||
name: a
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: b
|
||||
default: null
|
||||
)
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
33
vendor/nikic/php-parser/test/code/parser/stmt/function/conditional.test
vendored
Normal file
33
vendor/nikic/php-parser/test/code/parser/stmt/function/conditional.test
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
Conditional function definition
|
||||
-----
|
||||
<?php
|
||||
|
||||
if (true) {
|
||||
function A() {}
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_If(
|
||||
cond: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: true
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: A
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
elseifs: array(
|
||||
)
|
||||
else: null
|
||||
)
|
||||
)
|
148
vendor/nikic/php-parser/test/code/parser/stmt/function/defaultValues.test
vendored
Normal file
148
vendor/nikic/php-parser/test/code/parser/stmt/function/defaultValues.test
vendored
Normal file
|
@ -0,0 +1,148 @@
|
|||
Default values (static scalar tests)
|
||||
-----
|
||||
<?php
|
||||
|
||||
function a(
|
||||
$b = null,
|
||||
$c = 'foo',
|
||||
$d = A::B,
|
||||
$f = +1,
|
||||
$g = -1.0,
|
||||
$h = array(),
|
||||
$i = [],
|
||||
$j = ['foo'],
|
||||
$k = ['foo', 'bar' => 'baz']
|
||||
) {}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: a
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: b
|
||||
default: Expr_ConstFetch(
|
||||
name: Name(
|
||||
parts: array(
|
||||
0: null
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: c
|
||||
default: Scalar_String(
|
||||
value: foo
|
||||
)
|
||||
)
|
||||
2: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: d
|
||||
default: Expr_ClassConstFetch(
|
||||
class: Name(
|
||||
parts: array(
|
||||
0: A
|
||||
)
|
||||
)
|
||||
name: B
|
||||
)
|
||||
)
|
||||
3: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: f
|
||||
default: Expr_UnaryPlus(
|
||||
expr: Scalar_LNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
4: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: g
|
||||
default: Expr_UnaryMinus(
|
||||
expr: Scalar_DNumber(
|
||||
value: 1
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: h
|
||||
default: Expr_Array(
|
||||
items: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
6: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: i
|
||||
default: Expr_Array(
|
||||
items: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
7: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: j
|
||||
default: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: foo
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
8: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: k
|
||||
default: Expr_Array(
|
||||
items: array(
|
||||
0: Expr_ArrayItem(
|
||||
key: null
|
||||
value: Scalar_String(
|
||||
value: foo
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
1: Expr_ArrayItem(
|
||||
key: Scalar_String(
|
||||
value: bar
|
||||
)
|
||||
value: Scalar_String(
|
||||
value: baz
|
||||
)
|
||||
byRef: false
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
47
vendor/nikic/php-parser/test/code/parser/stmt/function/nullableTypes.test
vendored
Normal file
47
vendor/nikic/php-parser/test/code/parser/stmt/function/nullableTypes.test
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
Nullable types
|
||||
-----
|
||||
<?php
|
||||
|
||||
function test(?Foo $bar, ?string $foo) : ?Baz {
|
||||
}
|
||||
-----
|
||||
!!php7
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: test
|
||||
params: array(
|
||||
0: Param(
|
||||
type: NullableType(
|
||||
type: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
)
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: bar
|
||||
default: null
|
||||
)
|
||||
1: Param(
|
||||
type: NullableType(
|
||||
type: string
|
||||
)
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: foo
|
||||
default: null
|
||||
)
|
||||
)
|
||||
returnType: NullableType(
|
||||
type: Name(
|
||||
parts: array(
|
||||
0: Baz
|
||||
)
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
52
vendor/nikic/php-parser/test/code/parser/stmt/function/returnTypes.test
vendored
Normal file
52
vendor/nikic/php-parser/test/code/parser/stmt/function/returnTypes.test
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
Return type declarations
|
||||
-----
|
||||
<?php
|
||||
|
||||
function test1() {}
|
||||
function test2() : array {}
|
||||
function test3() : callable {}
|
||||
function test4() : Foo\Bar {}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: test1
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_Function(
|
||||
byRef: false
|
||||
name: test2
|
||||
params: array(
|
||||
)
|
||||
returnType: array
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
2: Stmt_Function(
|
||||
byRef: false
|
||||
name: test3
|
||||
params: array(
|
||||
)
|
||||
returnType: callable
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
3: Stmt_Function(
|
||||
byRef: false
|
||||
name: test4
|
||||
params: array(
|
||||
)
|
||||
returnType: Name(
|
||||
parts: array(
|
||||
0: Foo
|
||||
1: Bar
|
||||
)
|
||||
)
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
51
vendor/nikic/php-parser/test/code/parser/stmt/function/specialVars.test
vendored
Normal file
51
vendor/nikic/php-parser/test/code/parser/stmt/function/specialVars.test
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
Special function variables
|
||||
-----
|
||||
<?php
|
||||
|
||||
function a() {
|
||||
global $a, ${'b'}, $$c;
|
||||
static $c, $d = 'e';
|
||||
}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: a
|
||||
params: array(
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
0: Stmt_Global(
|
||||
vars: array(
|
||||
0: Expr_Variable(
|
||||
name: a
|
||||
)
|
||||
1: Expr_Variable(
|
||||
name: Scalar_String(
|
||||
value: b
|
||||
)
|
||||
)
|
||||
2: Expr_Variable(
|
||||
name: Expr_Variable(
|
||||
name: c
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1: Stmt_Static(
|
||||
vars: array(
|
||||
0: Stmt_StaticVar(
|
||||
name: c
|
||||
default: null
|
||||
)
|
||||
1: Stmt_StaticVar(
|
||||
name: d
|
||||
default: Scalar_String(
|
||||
value: e
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
49
vendor/nikic/php-parser/test/code/parser/stmt/function/typeDeclarations.test
vendored
Normal file
49
vendor/nikic/php-parser/test/code/parser/stmt/function/typeDeclarations.test
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
Type hints
|
||||
-----
|
||||
<?php
|
||||
|
||||
function a($b, array $c, callable $d, E $f) {}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: a
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: b
|
||||
default: null
|
||||
)
|
||||
1: Param(
|
||||
type: array
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: c
|
||||
default: null
|
||||
)
|
||||
2: Param(
|
||||
type: callable
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: d
|
||||
default: null
|
||||
)
|
||||
3: Param(
|
||||
type: Name(
|
||||
parts: array(
|
||||
0: E
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: f
|
||||
default: null
|
||||
)
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
110
vendor/nikic/php-parser/test/code/parser/stmt/function/variadic.test
vendored
Normal file
110
vendor/nikic/php-parser/test/code/parser/stmt/function/variadic.test
vendored
Normal file
|
@ -0,0 +1,110 @@
|
|||
Variadic functions
|
||||
-----
|
||||
<?php
|
||||
function test($a, ... $b) {}
|
||||
function test($a, &... $b) {}
|
||||
function test($a, Type ... $b) {}
|
||||
function test($a, Type &... $b) {}
|
||||
-----
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: test
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: a
|
||||
default: null
|
||||
)
|
||||
1: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: true
|
||||
name: b
|
||||
default: null
|
||||
)
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
1: Stmt_Function(
|
||||
byRef: false
|
||||
name: test
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: a
|
||||
default: null
|
||||
)
|
||||
1: Param(
|
||||
type: null
|
||||
byRef: true
|
||||
variadic: true
|
||||
name: b
|
||||
default: null
|
||||
)
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
2: Stmt_Function(
|
||||
byRef: false
|
||||
name: test
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: a
|
||||
default: null
|
||||
)
|
||||
1: Param(
|
||||
type: Name(
|
||||
parts: array(
|
||||
0: Type
|
||||
)
|
||||
)
|
||||
byRef: false
|
||||
variadic: true
|
||||
name: b
|
||||
default: null
|
||||
)
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
3: Stmt_Function(
|
||||
byRef: false
|
||||
name: test
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: false
|
||||
name: a
|
||||
default: null
|
||||
)
|
||||
1: Param(
|
||||
type: Name(
|
||||
parts: array(
|
||||
0: Type
|
||||
)
|
||||
)
|
||||
byRef: true
|
||||
variadic: true
|
||||
name: b
|
||||
default: null
|
||||
)
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
27
vendor/nikic/php-parser/test/code/parser/stmt/function/variadicDefaultValue.test
vendored
Normal file
27
vendor/nikic/php-parser/test/code/parser/stmt/function/variadicDefaultValue.test
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
Invalid variadic function
|
||||
-----
|
||||
<?php
|
||||
function foo(...$foo = []) {}
|
||||
-----
|
||||
Variadic parameter cannot have a default value from 2:24 to 2:25
|
||||
array(
|
||||
0: Stmt_Function(
|
||||
byRef: false
|
||||
name: foo
|
||||
params: array(
|
||||
0: Param(
|
||||
type: null
|
||||
byRef: false
|
||||
variadic: true
|
||||
name: foo
|
||||
default: Expr_Array(
|
||||
items: array(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
returnType: null
|
||||
stmts: array(
|
||||
)
|
||||
)
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue