interface ConstantDefinitionNode (View source)

Parser-agnostic interface for global constant definition AST nodes.

Represents define() function calls that define global constants.

Methods

string
getName()

Get the constant name.

mixed
getValue()

Get the constant value as a plain PHP scalar.

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.

Details

string getName()

Get the constant name.

Return Value

string

mixed getValue()

Get the constant value as a plain PHP scalar.

Returns null for complex expressions that cannot be statically evaluated.

Return Value

mixed

DocCommentNode|null getDocComment()

Get the doc comment node attached to this constant definition, or null if none.

Return Value

DocCommentNode|null

string getNamespace()

Get the namespace where this constant is defined.

Return Value

string

void setNamespace(string $namespace)

Set the namespace for this constant.

Parameters

string $namespace

Return Value

void