NikicGlobalConstantNode
class NikicGlobalConstantNode implements ConstantDefinitionNode (View source)
Adapter for nikic/php-parser Const_ nodes representing global const declarations.
Wraps individual constants from const statements (e.g., const A = 1, B = 2). Provides parser-agnostic access to constant properties.
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.
Get the doc comment node attached to this constant definition, or null if none.
Get the namespace where this constant is defined.
Set the namespace for this constant.
Details
__construct(Const_ $const, Doc|null $docComment = null)
No description
string
getName()
Get the constant name.
mixed
getValue()
Get the constant value as a plain PHP scalar.
Returns null for complex expressions that cannot be statically evaluated.
DocCommentNode|null
getDocComment()
Get the doc comment node attached to this constant definition, or null if none.
string
getNamespace()
Get the namespace where this constant is defined.
void
setNamespace(string $namespace)
Set the namespace for this constant.