2011-10-26 18:34:12 +02:00
|
|
|
<?php
|
|
|
|
|
2014-02-06 14:44:16 +01:00
|
|
|
namespace PhpParser\Node\Expr;
|
|
|
|
|
|
|
|
use PhpParser\Node;
|
|
|
|
use PhpParser\Node\Expr;
|
|
|
|
|
2011-10-26 18:34:12 +02:00
|
|
|
/**
|
2014-02-06 14:44:16 +01:00
|
|
|
* @property Node[] $stmts Statements
|
|
|
|
* @property Node\Param[] $params Parameters
|
|
|
|
* @property ClosureUse[] $uses use()s
|
|
|
|
* @property bool $byRef Whether to return by reference
|
|
|
|
* @property bool $static Whether the closure is static
|
2011-10-26 18:34:12 +02:00
|
|
|
*/
|
2014-02-06 14:44:16 +01:00
|
|
|
class Closure extends Expr
|
2011-10-26 18:34:12 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Constructs a lambda function node.
|
|
|
|
*
|
2012-04-29 23:32:09 +02:00
|
|
|
* @param array $subNodes Array of the following optional subnodes:
|
2014-03-22 14:49:56 +01:00
|
|
|
* 'static' => false : Whether the closure is static
|
|
|
|
* 'byRef' => false : Whether to return by reference
|
2012-04-29 23:32:09 +02:00
|
|
|
* 'params' => array(): Parameters
|
|
|
|
* 'uses' => array(): use()s
|
2014-03-22 14:49:56 +01:00
|
|
|
* 'stmts' => array(): Statements
|
2012-04-29 23:32:09 +02:00
|
|
|
* @param array $attributes Additional attributes
|
2011-10-26 18:34:12 +02:00
|
|
|
*/
|
2012-04-29 23:32:09 +02:00
|
|
|
public function __construct(array $subNodes = array(), array $attributes = array()) {
|
2011-10-26 18:34:12 +02:00
|
|
|
parent::__construct(
|
2014-03-22 14:49:56 +01:00
|
|
|
array(
|
|
|
|
'static' => isset($subNodes['static']) ? $subNodes['static'] : false,
|
|
|
|
'byRef' => isset($subNodes['byRef']) ? $subNodes['byRef'] : false,
|
|
|
|
'params' => isset($subNodes['params']) ? $subNodes['params'] : array(),
|
|
|
|
'uses' => isset($subNodes['uses']) ? $subNodes['uses'] : array(),
|
|
|
|
'stmts' => isset($subNodes['stmts']) ? $subNodes['stmts'] : array(),
|
2011-10-26 18:34:12 +02:00
|
|
|
),
|
2012-04-29 23:32:09 +02:00
|
|
|
$attributes
|
2011-10-26 18:34:12 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|