$parts
$parts : array<mixed,string>
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.
Doc comment object or null
None found |
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.
\PhpParser\Comment\Doc | $docComment | Doc comment to set |
None found |
setAttribute(string $key, mixed $value)
Sets an attribute on a node.
string | $key | |
mixed | $value |
None found |
hasAttribute(string $key) : boolean
Returns whether an attribute exists.
string | $key |
None found |
getAttribute(string $key, mixed $default = null) : mixed
Returns the value of an attribute.
string | $key | |
mixed | $default |
None found |
None found |
None found |
None found |
getFirst() : string
Gets the first part of the name, i.e. everything before the first namespace separator.
First part of the name
None found |
getLast() : string
Gets the last part of the name, i.e. everything after the last namespace separator.
Last part of the name
None found |
isUnqualified() : boolean
Checks whether the name is unqualified. (E.g. Name)
Whether the name is unqualified
None found |
isQualified() : boolean
Checks whether the name is qualified. (E.g. Name\Name)
Whether the name is qualified
None found |
isFullyQualified() : boolean
Checks whether the name is fully qualified. (E.g. \Name)
Whether the name is fully qualified
None found |
isRelative() : boolean
Checks whether the name is explicitly relative to the current namespace. (E.g. namespace\Name)
Whether the name is relative
None found |
toString() : string
Returns a string representation of the name by imploding the namespace parts with the namespace separator.
String representation
None found |
__toString() : string
Returns a string representation of the name by imploding the namespace parts with the namespace separator.
String representation
None found |
slice(integer $offset, integer|null $length = null) : static|null
Gets a slice of a name (similar to array_slice).
This method returns a new instance of the same type as the original and with the same attributes.
If the slice is empty, null is returned. The null value will be correctly handled in concatenations using concat().
Offset and length have the same meaning as in array_slice().
integer | $offset | Offset to start the slice at (may be negative) |
integer|null | $length | Length of the slice (may be negative) |
Sliced name
None found |
concat(string|array|self|null $name1, string|array|self|null $name2, array $attributes = array()) : static|null
Concatenate two names, yielding a new Name instance.
The type of the generated instance depends on which class this method is called on, for example Name\FullyQualified::concat() will yield a Name\FullyQualified instance.
If one of the arguments is null, a new instance of the other name will be returned. If both arguments are null, null will be returned. As such, writing Name::concat($namespace, $shortName) where $namespace is a Name node or null will work as expected.
string|array|self|null | $name1 | The first name |
string|array|self|null | $name2 | The second name |
array | $attributes | Attributes to assign to concatenated name |
Concatenated name
None found |
prepareName(string|array|self $name) : array
Prepares a (string, array or Name node) name for use in name changing methods by converting it to an array.
string|array|self | $name | Name to prepare |
Prepared name
None found |