Constants

TYPE_UNKNOWN

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_NORMAL

TYPE_NORMAL = 1

Class or namespace import

TYPE_FUNCTION

TYPE_FUNCTION = 2

Function import

TYPE_CONSTANT

TYPE_CONSTANT = 3

Constant import

Properties

$type

$type : integer

Type

integer — Type of alias

$attributes

$attributes : 

Type

Methods

__construct()

__construct(array<mixed,\PhpParser\Node\Stmt\UseUse>  $uses, integer  $type = self::TYPE_NORMAL, array  $attributes = array()) 

Constructs an alias (use) list node.

Parameters

array<mixed,\PhpParser\Node\Stmt\UseUse> $uses

Aliases

integer $type

Type of alias

array $attributes

Additional attributes

getType()

getType() : string

Gets the type of the node.

Returns

string —

Type of the node

getLine()

getLine() : integer

Gets line the node started in.

Returns

integer —

Line

setLine()

setLine(integer  $line) 

Sets line the node started in.

Parameters

integer $line

Line

getDocComment()

getDocComment() : null|\PhpParser\Comment\Doc

Gets the doc comment of the node.

The doc comment has to be the last comment associated with the node.

Returns

null|\PhpParser\Comment\Doc

Doc comment object or null

setDocComment()

setDocComment(\PhpParser\Comment\Doc  $docComment) 

Sets the doc comment of the node.

This will either replace an existing doc comment or add it to the comments array.

Parameters

\PhpParser\Comment\Doc $docComment

Doc comment to set

setAttribute()

setAttribute(string  $key, mixed  $value) 

Sets an attribute on a node.

Parameters

string $key
mixed $value

hasAttribute()

hasAttribute(string  $key) : boolean

Returns whether an attribute exists.

Parameters

string $key

Returns

boolean

getAttribute()

getAttribute(string  $key, mixed  $default = null) : mixed

Returns the value of an attribute.

Parameters

string $key
mixed $default

Returns

mixed

getAttributes()

getAttributes() : array

Returns all attributes for the given node.

Returns

array

jsonSerialize()

jsonSerialize() 

getSubNodeNames()

getSubNodeNames()