Use_
extends Stmt
in package
Table of Contents
- TYPE_CONSTANT = 3
- Constant import
- TYPE_FUNCTION = 2
- Function import
- TYPE_NORMAL = 1
- Class or namespace import
- TYPE_UNKNOWN = 0
- Unknown type. Both Stmt\Use_ / Stmt\GroupUse and Stmt\UseUse have a $type property, one of them will always be TYPE_UNKNOWN while the other has one of the three other possible types. For normal use statements the type on the Stmt\UseUse is unknown. It's only the other way around for mixed group use declarations.
- $type : int
- $uses : array<string|int, UseUse>
- $attributes : mixed
- __construct() : mixed
- Constructs an alias (use) list node.
- getAttribute() : mixed
- Returns the value of an attribute.
- getAttributes() : array<string|int, mixed>
- Returns all the attributes of this node.
- getComments() : array<string|int, Comment>
- Gets all comments directly preceding this node.
- getDocComment() : null|Doc
- Gets the doc comment of the node.
- getEndFilePos() : int
- Gets the file offset of the last character that is part of this node.
- getEndLine() : int
- Gets the line the node ended in.
- getEndTokenPos() : int
- Gets the token offset of the last token that is part of this node.
- getLine() : int
- Gets line the node started in (alias of getStartLine).
- getStartFilePos() : int
- Gets the file offset of the first character that is part of this node.
- getStartLine() : int
- Gets line the node started in.
- getStartTokenPos() : int
- Gets the token offset of the first token that is part of this node.
- getSubNodeNames() : array<string|int, mixed>
- getType() : string
- hasAttribute() : bool
- Returns whether an attribute exists.
- jsonSerialize() : array<string|int, mixed>
- setAttribute() : mixed
- Sets an attribute on a node.
- setAttributes() : mixed
- Replaces all the attributes of this node.
- setDocComment() : mixed
- Sets the doc comment of the node.
Constants
TYPE_CONSTANT
Constant import
public
mixed
TYPE_CONSTANT
= 3
TYPE_FUNCTION
Function import
public
mixed
TYPE_FUNCTION
= 2
TYPE_NORMAL
Class or namespace import
public
mixed
TYPE_NORMAL
= 1
TYPE_UNKNOWN
Unknown type. Both Stmt\Use_ / Stmt\GroupUse and Stmt\UseUse have a $type property, one of them will always be TYPE_UNKNOWN while the other has one of the three other possible types. For normal use statements the type on the Stmt\UseUse is unknown. It's only the other way around for mixed group use declarations.
public
mixed
TYPE_UNKNOWN
= 0
Properties
$type
public
int
$type
Type of alias
$uses
public
array<string|int, UseUse>
$uses
Aliases
$attributes
protected
mixed
$attributes
Methods
__construct()
Constructs an alias (use) list node.
public
__construct(array<string|int, UseUse> $uses[, int $type = self::TYPE_NORMAL ][, array<string|int, mixed> $attributes = [] ]) : mixed
Parameters
- $uses : array<string|int, UseUse>
-
Aliases
- $type : int = self::TYPE_NORMAL
-
Type of alias
- $attributes : array<string|int, mixed> = []
-
Additional attributes
Return values
mixed —getAttribute()
Returns the value of an attribute.
public
getAttribute(string $key[, mixed $default = null ]) : mixed
Parameters
- $key : string
- $default : mixed = null
Return values
mixed —getAttributes()
Returns all the attributes of this node.
public
getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —getComments()
Gets all comments directly preceding this node.
public
getComments() : array<string|int, Comment>
The comments are also available through the "comments" attribute.
Return values
array<string|int, Comment> —getDocComment()
Gets the doc comment of the node.
public
getDocComment() : null|Doc
Return values
null|Doc —Doc comment object or null
getEndFilePos()
Gets the file offset of the last character that is part of this node.
public
getEndFilePos() : int
Requires the 'endFilePos' attribute to be enabled in the lexer (DISABLED by default).
Return values
int —File end position (or -1 if not available)
getEndLine()
Gets the line the node ended in.
public
getEndLine() : int
Requires the 'endLine' attribute to be enabled in the lexer (enabled by default).
Return values
int —End line (or -1 if not available)
getEndTokenPos()
Gets the token offset of the last token that is part of this node.
public
getEndTokenPos() : int
The offset is an index into the array returned by Lexer::getTokens().
Requires the 'endTokenPos' attribute to be enabled in the lexer (DISABLED by default).
Return values
int —Token end position (or -1 if not available)
getLine()
Gets line the node started in (alias of getStartLine).
public
getLine() : int
Return values
int —Start line (or -1 if not available)
getStartFilePos()
Gets the file offset of the first character that is part of this node.
public
getStartFilePos() : int
Requires the 'startFilePos' attribute to be enabled in the lexer (DISABLED by default).
Return values
int —File start position (or -1 if not available)
getStartLine()
Gets line the node started in.
public
getStartLine() : int
Requires the 'startLine' attribute to be enabled in the lexer (enabled by default).
Return values
int —Start line (or -1 if not available)
getStartTokenPos()
Gets the token offset of the first token that is part of this node.
public
getStartTokenPos() : int
The offset is an index into the array returned by Lexer::getTokens().
Requires the 'startTokenPos' attribute to be enabled in the lexer (DISABLED by default).
Return values
int —Token start position (or -1 if not available)
getSubNodeNames()
public
getSubNodeNames() : array<string|int, mixed>
Return values
array<string|int, mixed> —getType()
public
getType() : string
Return values
string —hasAttribute()
Returns whether an attribute exists.
public
hasAttribute(string $key) : bool
Parameters
- $key : string
Return values
bool —jsonSerialize()
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —setAttribute()
Sets an attribute on a node.
public
setAttribute(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
Return values
mixed —setAttributes()
Replaces all the attributes of this node.
public
setAttributes(array<string|int, mixed> $attributes) : mixed
Parameters
- $attributes : array<string|int, mixed>
Return values
mixed —setDocComment()
Sets the doc comment of the node.
public
setDocComment(Doc $docComment) : mixed
This will either replace an existing doc comment or add it to the comments array.
Parameters
- $docComment : Doc
-
Doc comment to set