ConstantNode
interface ConstantNode (View source)
Parser-agnostic interface for constant AST nodes.
Exposes all constant properties needed for complete parsing.
Methods
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
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+).