ParserEnum
Less than 1 minute
ParserEnum
Parses class declarations from a token stream.
class ParserEnum extends \Hazaar\Parser\PHP\ParserClassThis parser extracts class metadata (name, inheritance, implemented interfaces, class members, and constructor-promoted properties) from tokenised PHP source and stores the result on this object.
Properties
cases
An array of enum cases declared in the enum body.
public array $casestype
public string $typeparserObjectType
Token type this parser recognises as the object declaration keyword.
protected int $parserObjectType = 'T_ENUM'Defaults to T_CLASS and can be overridden by subclasses that parse similar class-like constructs.
Methods
parse
protected parse(array $tokens): boolParameters
| Parameter | Type | Description |
|---|---|---|
$tokens | array |
parseEnumCases
Parses enum cases from the token stream until the first method declaration is encountered.
protected parseEnumCases(array $tokens): voidParameters
| Parameter | Type | Description |
|---|---|---|
$tokens | array | token stream passed by reference with the internal pointer used for parsing |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:25 +0000