2011-11-27 11:20:35 +01:00
|
|
|
Closures
|
|
|
|
-----
|
|
|
|
<?php
|
|
|
|
function($a) { $a; };
|
|
|
|
function($a) use($b) {};
|
|
|
|
function() use($a, &$b) {};
|
|
|
|
function &($a) {};
|
|
|
|
static function() {};
|
2015-03-12 13:17:31 +01:00
|
|
|
function($a) : array {};
|
|
|
|
function() use($a) : \Foo\Bar {};
|
2011-11-27 11:20:35 +01:00
|
|
|
-----
|
|
|
|
array(
|
2017-01-19 22:25:22 +01:00
|
|
|
0: Stmt_Expression(
|
|
|
|
expr: Expr_Closure(
|
|
|
|
static: false
|
|
|
|
byRef: false
|
|
|
|
params: array(
|
|
|
|
0: Param(
|
|
|
|
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: a
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
default: null
|
|
|
|
)
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
uses: array(
|
|
|
|
)
|
|
|
|
returnType: null
|
|
|
|
stmts: array(
|
|
|
|
0: Stmt_Expression(
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
)
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
1: Stmt_Expression(
|
|
|
|
expr: Expr_Closure(
|
|
|
|
static: false
|
|
|
|
byRef: false
|
|
|
|
params: array(
|
|
|
|
0: Param(
|
|
|
|
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: a
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
default: null
|
|
|
|
)
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
uses: array(
|
|
|
|
0: Expr_ClosureUse(
|
2017-01-19 23:23:38 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
byRef: false
|
|
|
|
)
|
|
|
|
)
|
|
|
|
returnType: null
|
|
|
|
stmts: array(
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
2: Stmt_Expression(
|
|
|
|
expr: Expr_Closure(
|
|
|
|
static: false
|
|
|
|
byRef: false
|
|
|
|
params: array(
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
uses: array(
|
|
|
|
0: Expr_ClosureUse(
|
2017-01-19 23:23:38 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
byRef: false
|
|
|
|
)
|
|
|
|
1: Expr_ClosureUse(
|
2017-01-19 23:23:38 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
byRef: true
|
|
|
|
)
|
|
|
|
)
|
|
|
|
returnType: null
|
|
|
|
stmts: array(
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
3: Stmt_Expression(
|
|
|
|
expr: Expr_Closure(
|
|
|
|
static: false
|
|
|
|
byRef: true
|
|
|
|
params: array(
|
|
|
|
0: Param(
|
|
|
|
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: a
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
default: null
|
|
|
|
)
|
|
|
|
)
|
|
|
|
uses: array(
|
|
|
|
)
|
|
|
|
returnType: null
|
|
|
|
stmts: array(
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
4: Stmt_Expression(
|
|
|
|
expr: Expr_Closure(
|
|
|
|
static: true
|
|
|
|
byRef: false
|
|
|
|
params: array(
|
|
|
|
)
|
|
|
|
uses: array(
|
|
|
|
)
|
|
|
|
returnType: null
|
|
|
|
stmts: array(
|
|
|
|
)
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
5: Stmt_Expression(
|
|
|
|
expr: Expr_Closure(
|
|
|
|
static: false
|
|
|
|
byRef: false
|
|
|
|
params: array(
|
|
|
|
0: Param(
|
|
|
|
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: a
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
default: null
|
|
|
|
)
|
|
|
|
)
|
|
|
|
uses: array(
|
|
|
|
)
|
2017-04-28 19:09:39 +02:00
|
|
|
returnType: Identifier(
|
|
|
|
name: array
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
stmts: array(
|
2015-03-12 13:17:31 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
6: Stmt_Expression(
|
|
|
|
expr: Expr_Closure(
|
|
|
|
static: false
|
|
|
|
byRef: false
|
|
|
|
params: array(
|
2015-03-12 13:17:31 +01:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
uses: array(
|
|
|
|
0: Expr_ClosureUse(
|
2017-01-19 23:23:38 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
byRef: false
|
|
|
|
)
|
|
|
|
)
|
|
|
|
returnType: Name_FullyQualified(
|
|
|
|
parts: array(
|
|
|
|
0: Foo
|
|
|
|
1: Bar
|
|
|
|
)
|
|
|
|
)
|
|
|
|
stmts: array(
|
2015-03-12 13:17:31 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
)
|