class NikicConstantDefinitionNode implements ConstantDefinitionNode (View source)

Adapter for nikic/php-parser FuncCall nodes representing define() calls.

Wraps define() function calls and provides parser-agnostic access to constant properties.

Traits

Resolves PhpParser expression nodes to plain PHP scalar values.

Methods

__construct(FuncCall $funcCall, Doc|null $docComment = null)

No description

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

__construct(FuncCall $funcCall, Doc|null $docComment = null)

No description

Parameters

FuncCall $funcCall

The define() call expression.

Doc|null $docComment

The doc comment, which nikic attaches to the wrapping Expression statement rather than to the FuncCall itself.

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