NikicConstantNode
class NikicConstantNode implements ConstantNode (View source)
Adapter for nikic/php-parser Const_ nodes.
Implements complete ConstantNode interface. Requires both Const_ (for name) and ClassConst statement (for visibility/final).
Traits
Resolves PhpParser expression nodes to plain PHP scalar values.
Methods
No description
Get the constant name.
Get the constant value as a plain PHP scalar, or null for complex expressions.
Check if the constant is public (PHP 7.1+).
Check if the constant is protected (PHP 7.1+).
Check if the constant is private (PHP 7.1+).
Check if the constant is final (PHP 8.1+).
Get the doc comment, or null if no doc comment.
Get the constant attributes (PHP 8.0+).
Details
__construct(Const_ $constant, ClassConst $classConst)
No description
string
getName()
Get the constant name.
mixed
getValue()
Get the constant value as a plain PHP scalar, or null for complex expressions.
bool
isPublic()
Check if the constant is public (PHP 7.1+).
bool
isProtected()
Check if the constant is protected (PHP 7.1+).
bool
isPrivate()
Check if the constant is private (PHP 7.1+).
bool
isFinal()
Check if the constant is final (PHP 8.1+).
DocCommentNode|null
getDocComment()
Get the doc comment, or null if no doc comment.
array
getAttributes()
Get the constant attributes (PHP 8.0+).