NikicEnumNode
class NikicEnumNode implements EnumNode (View source)
Adapter for nikic/php-parser Enum_ nodes.
Wraps Enum_ and provides parser-agnostic access to enum properties.
Methods
No description
Get the enum name.
Get the enum namespace.
Set the namespace for this enum.
Get the backing type for backed enums (string or int), or null for unit enums.
Get enum case names.
Get the enum methods.
Get implemented interface names.
Whether the enum is declared with the final keyword in the source.
Get the enum constants.
Get the doc comment, or null if no doc comment.
Details
__construct(Enum_ $enum)
No description
string
getName()
Get the enum name.
string
getNamespace()
Get the enum namespace.
void
setNamespace(string $namespace)
Set the namespace for this enum.
TypeNode|null
getBackingType()
Get the backing type for backed enums (string or int), or null for unit enums.
array
getCaseNames()
Get enum case names.
array
getMethods()
Get the enum methods.
array
getImplementedInterfaceNames()
Get implemented interface names.
bool
isFinal()
Whether the enum is declared with the final keyword in the source.
PHP does not support final enum syntax, so this returns false for stub
enum nodes. Reflection may report true (PHP 8.2+) due to implicit finality.
The validator compares this against reflection to detect mismatches.
array
getConstants()
Get the enum constants.
DocCommentNode|null
getDocComment()
Get the doc comment, or null if no doc comment.