interface ClassNode (View source)

Parser-agnostic interface for class AST nodes.

Implementations wrap specific parser library nodes (e.g., nikic/php-parser).

Methods

string
getName()

Get the class name.

bool
isFinal()

Check if the class is final.

bool
isReadonly()

Check if the class is readonly.

string|null
getParentClassName()

Get the parent class name, or null if no parent.

array
getInterfaceNames()

Get the names of implemented interfaces.

array
getMethods()

Get the class methods.

array
getProperties()

Get the class properties.

array
getConstants()

Get the class constants.

void
setNamespace(string $namespace)

Set the namespace for this class.

string
getNamespace()

Get the namespace for this class.

getDocComment()

Get the DocComment for this class.

array
getAttributes()

Get the attributes for this class.

Details

string getName()

Get the class name.

Return Value

string

bool isFinal()

Check if the class is final.

Return Value

bool

bool isReadonly()

Check if the class is readonly.

Return Value

bool

string|null getParentClassName()

Get the parent class name, or null if no parent.

Return Value

string|null

array getInterfaceNames()

Get the names of implemented interfaces.

Return Value

array

array getMethods()

Get the class methods.

Return Value

array

array getProperties()

Get the class properties.

Return Value

array

array getConstants()

Get the class constants.

Return Value

array

void setNamespace(string $namespace)

Set the namespace for this class.

Parameters

string $namespace

Return Value

void

string getNamespace()

Get the namespace for this class.

Return Value

string

DocCommentNode|null getDocComment()

Get the DocComment for this class.

Return Value

DocCommentNode|null

array getAttributes()

Get the attributes for this class.

Return Value

array