class Function_
Same name in this branch
- 11.1.x vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Function_.php \PhpParser\Node\Scalar\MagicConst\Function_
- 11.1.x vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php \PhpParser\Builder\Function_
- 11.1.x vendor/mck89/peast/lib/Peast/Syntax/Node/Function_.php \Peast\Syntax\Node\Function_
Hierarchy
- class \PhpParser\Node\Stmt\Function_ extends \Node\Stmt implements \PhpParser\Node\FunctionLike
Expanded class hierarchy of Function_
4 files declare their use of Function_
- CodeUnitFindingVisitor.php in vendor/
phpunit/ php-code-coverage/ src/ StaticAnalysis/ CodeUnitFindingVisitor.php - ComplexityCalculatingVisitor.php in vendor/
sebastian/ complexity/ src/ Visitor/ ComplexityCalculatingVisitor.php - DeprecatedHookImplementation.php in vendor/
mglaman/ phpstan-drupal/ src/ Rules/ Deprecations/ DeprecatedHookImplementation.php - IgnoredLinesFindingVisitor.php in vendor/
phpunit/ php-code-coverage/ src/ StaticAnalysis/ IgnoredLinesFindingVisitor.php
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ Node/ Stmt/ Function_.php, line 8
Namespace
PhpParser\Node\StmtView source
class Function_ extends Node\Stmt implements FunctionLike {
/** @var bool Whether function returns by reference */
public bool $byRef;
/** @var Node\Identifier Name */
public Node\Identifier $name;
/** @var Node\Param[] Parameters */
public array $params;
/** @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;
/** @var Node\Name|null Namespaced name (if using NameResolver) */
public ?Node\Name $namespacedName;
/**
* Constructs a function node.
*
* @param string|Node\Identifier $name Name
* @param array{
* byRef?: bool,
* params?: Node\Param[],
* returnType?: null|Node\Identifier|Node\Name|Node\ComplexType,
* stmts?: Node\Stmt[],
* attrGroups?: Node\AttributeGroup[],
* } $subNodes Array of the following optional subnodes:
* 'byRef' => false : Whether to return by reference
* 'params' => array(): Parameters
* 'returnType' => null : Return type
* 'stmts' => array(): Statements
* 'attrGroups' => array(): PHP attribute groups
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct($name, array $subNodes = [], array $attributes = []) {
$this->attributes = $attributes;
$this->byRef = $subNodes['byRef'] ?? false;
$this->name = \is_string($name) ? new Node\Identifier($name) : $name;
$this->params = $subNodes['params'] ?? [];
$this->returnType = $subNodes['returnType'] ?? null;
$this->stmts = $subNodes['stmts'] ?? [];
$this->attrGroups = $subNodes['attrGroups'] ?? [];
}
public function getSubNodeNames() : array {
return [
'attrGroups',
'byRef',
'name',
'params',
'returnType',
'stmts',
];
}
public function returnsByRef() : bool {
return $this->byRef;
}
public function getParams() : array {
return $this->params;
}
public function getReturnType() {
return $this->returnType;
}
public function getAttrGroups() : array {
return $this->attrGroups;
}
/** @return Node\Stmt[] */
public function getStmts() : array {
return $this->stmts;
}
public function getType() : string {
return 'Stmt_Function';
}
}
Members
Title Sort descending | Deprecated | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|---|
Function_::$attrGroups | public | property | @var Node\AttributeGroup[] PHP attribute groups | |||
Function_::$byRef | public | property | @var bool Whether function returns by reference | |||
Function_::$name | public | property | @var Node\Identifier Name | |||
Function_::$namespacedName | public | property | @var Node\Name|null Namespaced name (if using NameResolver) | |||
Function_::$params | public | property | @var Node\Param[] Parameters | |||
Function_::$returnType | public | property | @var null|Node\Identifier|Node\Name|Node\ComplexType Return type | |||
Function_::$stmts | public | property | @var Node\Stmt[] Statements | |||
Function_::getAttrGroups | public | function | Get PHP attribute groups. | Overrides FunctionLike::getAttrGroups | ||
Function_::getParams | public | function | List of parameters | Overrides FunctionLike::getParams | ||
Function_::getReturnType | public | function | Get the declared return type or null | Overrides FunctionLike::getReturnType | ||
Function_::getStmts | public | function | Overrides FunctionLike::getStmts | |||
Function_::getSubNodeNames | public | function | Gets the names of the sub nodes. | Overrides Node::getSubNodeNames | ||
Function_::getType | public | function | Gets the type of the node. | Overrides Node::getType | ||
Function_::returnsByRef | public | function | Whether to return by reference | Overrides FunctionLike::returnsByRef | ||
Function_::__construct | public | function | Constructs a 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 |