2011-12-07 18:17:05 +01:00
|
|
|
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
|
2017-04-28 19:09:39 +02:00
|
|
|
name: Identifier(
|
|
|
|
name: a
|
|
|
|
)
|
2011-12-07 18:17:05 +01:00
|
|
|
params: array(
|
|
|
|
0: Param(
|
2014-03-26 18:23:30 +01:00
|
|
|
type: null
|
|
|
|
byRef: false
|
|
|
|
variadic: false
|
2017-01-19 23:38:40 +01:00
|
|
|
var: Expr_Variable(
|
2017-01-19 23:23:38 +01:00
|
|
|
name: b
|
|
|
|
)
|
2011-12-07 18:17:05 +01:00
|
|
|
default: Expr_ConstFetch(
|
|
|
|
name: Name(
|
|
|
|
parts: array(
|
|
|
|
0: null
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
1: Param(
|
2014-03-26 18:23:30 +01:00
|
|
|
type: null
|
|
|
|
byRef: false
|
|
|
|
variadic: false
|
2017-01-19 23:38:40 +01:00
|
|
|
var: Expr_Variable(
|
2017-01-19 23:23:38 +01:00
|
|
|
name: c
|
|
|
|
)
|
2011-12-07 18:17:05 +01:00
|
|
|
default: Scalar_String(
|
|
|
|
value: foo
|
|
|
|
)
|
|
|
|
)
|
|
|
|
2: Param(
|
2014-03-26 18:23:30 +01:00
|
|
|
type: null
|
|
|
|
byRef: false
|
|
|
|
variadic: false
|
2017-01-19 23:38:40 +01:00
|
|
|
var: Expr_Variable(
|
2017-01-19 23:23:38 +01:00
|
|
|
name: d
|
|
|
|
)
|
2011-12-07 18:17:05 +01:00
|
|
|
default: Expr_ClassConstFetch(
|
|
|
|
class: Name(
|
|
|
|
parts: array(
|
|
|
|
0: A
|
|
|
|
)
|
|
|
|
)
|
2017-04-28 19:09:39 +02:00
|
|
|
name: Identifier(
|
|
|
|
name: B
|
|
|
|
)
|
2011-12-07 18:17:05 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
3: Param(
|
2014-03-26 18:23:30 +01:00
|
|
|
type: null
|
|
|
|
byRef: false
|
|
|
|
variadic: false
|
2017-01-19 23:38:40 +01:00
|
|
|
var: Expr_Variable(
|
2017-01-19 23:23:38 +01:00
|
|
|
name: f
|
|
|
|
)
|
2011-12-07 18:17:05 +01:00
|
|
|
default: Expr_UnaryPlus(
|
|
|
|
expr: Scalar_LNumber(
|
|
|
|
value: 1
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
4: Param(
|
2014-03-26 18:23:30 +01:00
|
|
|
type: null
|
|
|
|
byRef: false
|
|
|
|
variadic: false
|
2017-01-19 23:38:40 +01:00
|
|
|
var: Expr_Variable(
|
2017-01-19 23:23:38 +01:00
|
|
|
name: g
|
|
|
|
)
|
2011-12-07 18:17:05 +01:00
|
|
|
default: Expr_UnaryMinus(
|
|
|
|
expr: Scalar_DNumber(
|
|
|
|
value: 1
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
5: Param(
|
2014-03-26 18:23:30 +01:00
|
|
|
type: null
|
|
|
|
byRef: false
|
|
|
|
variadic: false
|
2017-01-19 23:38:40 +01:00
|
|
|
var: Expr_Variable(
|
2017-01-19 23:23:38 +01:00
|
|
|
name: h
|
|
|
|
)
|
2011-12-07 18:17:05 +01:00
|
|
|
default: Expr_Array(
|
|
|
|
items: array(
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
6: Param(
|
2014-03-26 18:23:30 +01:00
|
|
|
type: null
|
|
|
|
byRef: false
|
|
|
|
variadic: false
|
2017-01-19 23:38:40 +01:00
|
|
|
var: Expr_Variable(
|
2017-01-19 23:23:38 +01:00
|
|
|
name: i
|
|
|
|
)
|
2011-12-07 18:17:05 +01:00
|
|
|
default: Expr_Array(
|
|
|
|
items: array(
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
7: Param(
|
2014-03-26 18:23:30 +01:00
|
|
|
type: null
|
|
|
|
byRef: false
|
|
|
|
variadic: false
|
2017-01-19 23:38:40 +01:00
|
|
|
var: Expr_Variable(
|
2017-01-19 23:23:38 +01:00
|
|
|
name: j
|
|
|
|
)
|
2011-12-07 18:17:05 +01:00
|
|
|
default: Expr_Array(
|
|
|
|
items: array(
|
|
|
|
0: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Scalar_String(
|
|
|
|
value: foo
|
|
|
|
)
|
|
|
|
byRef: false
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
8: Param(
|
2014-03-26 18:23:30 +01:00
|
|
|
type: null
|
|
|
|
byRef: false
|
|
|
|
variadic: false
|
2017-01-19 23:38:40 +01:00
|
|
|
var: Expr_Variable(
|
2017-01-19 23:23:38 +01:00
|
|
|
name: k
|
|
|
|
)
|
2011-12-07 18:17:05 +01:00
|
|
|
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
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2015-03-12 13:17:31 +01:00
|
|
|
returnType: null
|
2011-12-07 18:17:05 +01:00
|
|
|
stmts: array(
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
)
|