class Closure
Hierarchy
- class \PhpParser\NodeAbstract implements \PhpParser\Node, \PhpParser\JsonSerializable
- class \PhpParser\Node\Expr extends \PhpParser\NodeAbstract
- class \PhpParser\Node\Expr\Closure extends \PhpParser\Node\Expr implements \PhpParser\Node\FunctionLike
- class \PhpParser\Node\Expr extends \PhpParser\NodeAbstract
Expanded class hierarchy of Closure
21 string references to 'Closure'
- AutowireCallable::buildDefinition in vendor/
symfony/ dependency-injection/ Attribute/ AutowireCallable.php - CallbackPrediction::check in vendor/
phpspec/ prophecy/ src/ Prophecy/ Prediction/ CallbackPrediction.php - Tests that double fulfilled prediction.
- CallbackPromise::execute in vendor/
phpspec/ prophecy/ src/ Prophecy/ Promise/ CallbackPromise.php - Evaluates promise.
- ClosureLoader::supports in vendor/
symfony/ routing/ Loader/ ClosureLoader.php - ContainerBuilder::createService in vendor/
symfony/ dependency-injection/ ContainerBuilder.php - Creates a service for a service definition.
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ Node/ Expr/ Closure.php, line 10
Namespace
PhpParser\Node\ExprView source
class Closure extends Expr implements FunctionLike {
/** @var bool Whether the closure is static */
public bool $static;
/** @var bool Whether to return by reference */
public bool $byRef;
/** @var Node\Param[] Parameters */
public array $params;
/** @var ClosureUse[] use()s */
public array $uses;
/** @var null|Node\Identifier|Node\Name|Node\ComplexType Return type */
public ?Node $returnType;
/** @var Node\Stmt[] Statements */
public array $stmts;
/** @var Node\AttributeGroup[] PHP attribute groups */
public array $attrGroups;
/**
* Constructs a lambda function node.
*
* @param array{
* static?: bool,
* byRef?: bool,
* params?: Node\Param[],
* uses?: ClosureUse[],
* returnType?: null|Node\Identifier|Node\Name|Node\ComplexType,
* stmts?: Node\Stmt[],
* attrGroups?: Node\AttributeGroup[],
* } $subNodes Array of the following optional subnodes:
* 'static' => false : Whether the closure is static
* 'byRef' => false : Whether to return by reference
* 'params' => array(): Parameters
* 'uses' => array(): use()s
* 'returnType' => null : Return type
* 'stmts' => array(): Statements
* 'attrGroups' => array(): PHP attributes groups
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(array $subNodes = [], array $attributes = []) {
$this->attributes = $attributes;
$this->static = $subNodes['static'] ?? false;
$this->byRef = $subNodes['byRef'] ?? false;
$this->params = $subNodes['params'] ?? [];
$this->uses = $subNodes['uses'] ?? [];
$this->returnType = $subNodes['returnType'] ?? null;
$this->stmts = $subNodes['stmts'] ?? [];
$this->attrGroups = $subNodes['attrGroups'] ?? [];
}
public function getSubNodeNames() : array {
return [
'attrGroups',
'static',
'byRef',
'params',
'uses',
'returnType',
'stmts',
];
}
public function returnsByRef() : bool {
return $this->byRef;
}
public function getParams() : array {
return $this->params;
}
public function getReturnType() {
return $this->returnType;
}
/** @return Node\Stmt[] */
public function getStmts() : array {
return $this->stmts;
}
public function getAttrGroups() : array {
return $this->attrGroups;
}
public function getType() : string {
return 'Expr_Closure';
}
}
Members
Title Sort descending | Deprecated | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|---|
Closure::$attrGroups | public | property | @var Node\AttributeGroup[] PHP attribute groups | |||
Closure::$byRef | public | property | @var bool Whether to return by reference | |||
Closure::$params | public | property | @var Node\Param[] Parameters | |||
Closure::$returnType | public | property | @var null|Node\Identifier|Node\Name|Node\ComplexType Return type | |||
Closure::$static | public | property | @var bool Whether the closure is static | |||
Closure::$stmts | public | property | @var Node\Stmt[] Statements | |||
Closure::$uses | public | property | @var ClosureUse[] use()s | |||
Closure::getAttrGroups | public | function | Get PHP attribute groups. | Overrides FunctionLike::getAttrGroups | ||
Closure::getParams | public | function | List of parameters | Overrides FunctionLike::getParams | ||
Closure::getReturnType | public | function | Get the declared return type or null | Overrides FunctionLike::getReturnType | ||
Closure::getStmts | public | function | Overrides FunctionLike::getStmts | |||
Closure::getSubNodeNames | public | function | Gets the names of the sub nodes. | Overrides Node::getSubNodeNames | ||
Closure::getType | public | function | Gets the type of the node. | Overrides Node::getType | ||
Closure::returnsByRef | public | function | Whether to return by reference | Overrides FunctionLike::returnsByRef | ||
Closure::__construct | public | function | Constructs a lambda function node. | |||
Node::getAttribute | public | function | Returns the value of an attribute. | 1 | ||
Node::getAttributes | public | function | Returns all the attributes of this node. | 1 | ||
Node::getComments | public | function | Gets all comments directly preceding this node. | 1 | ||
Node::getDocComment | public | function | Gets the doc comment of the node. | 1 | ||
Node::getEndFilePos | public | function | Gets the file offset of the last character that is part of this node. | 1 | ||
Node::getEndLine | public | function | Gets the line the node ended in. | 1 | ||
Node::getEndTokenPos | public | function | Gets the token offset of the last token that is part of this node. | 1 | ||
Node::getLine | Deprecated | public | function | Gets line the node started in (alias of getStartLine). | 1 | |
Node::getStartFilePos | public | function | Gets the file offset of the first character that is part of this node. | 1 | ||
Node::getStartLine | public | function | Gets line the node started in. | 1 | ||
Node::getStartTokenPos | public | function | Gets the token offset of the first token that is part of this node. | 1 | ||
Node::hasAttribute | public | function | Returns whether an attribute exists. | 1 | ||
Node::setAttribute | public | function | Sets an attribute on a node. | 1 | ||
Node::setAttributes | public | function | Replaces all the attributes of this node. | 1 | ||
Node::setDocComment | public | function | Sets the doc comment of the node. | 1 |