interface ConstantNode (View source)

Parser-agnostic interface for constant AST nodes.

Exposes all constant properties needed for complete parsing.

Methods

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

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