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

__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+).

getDocComment()

Get the doc comment, or null if no doc comment.

array
getAttributes()

Get the constant attributes (PHP 8.0+).

Details

__construct(Const_ $constant, ClassConst $classConst)

No description

Parameters

Const_ $constant
ClassConst $classConst

string getName()

Get the constant name.

Return Value

string

mixed getValue()

Get the constant value as a plain PHP scalar, or null for complex expressions.

Return Value

mixed

bool isPublic()

Check if the constant is public (PHP 7.1+).

Return Value

bool

bool isProtected()

Check if the constant is protected (PHP 7.1+).

Return Value

bool

bool isPrivate()

Check if the constant is private (PHP 7.1+).

Return Value

bool

bool isFinal()

Check if the constant is final (PHP 8.1+).

Return Value

bool

DocCommentNode|null getDocComment()

Get the doc comment, or null if no doc comment.

Return Value

DocCommentNode|null

array getAttributes()

Get the constant attributes (PHP 8.0+).

Return Value

array