ParserClass
ParserClass
Parses class declarations from a token stream.
class ParserClass extends \Hazaar\Parser\PHP\TokenParserThis 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
abstract
Indicates whether the parsed class is declared as abstract.
public bool $abstractextends
public string $extendsimplements
Fully-qualified interface names from the implements clause.
public array $implementsproperties
Class properties declared directly in the class body and via
public array $propertiesconstructor property promotion.
methods
Methods declared by the class.
public array $methodsconstants
Class constants declared in the class body.
public array $constantsparserObjectType
Token type this parser recognises as the object declaration keyword.
protected int $parserObjectType = 'T_CLASS'Defaults to T_CLASS and can be overridden by subclasses that parse similar class-like constructs.
Methods
parse
Parses a class declaration from the current token position.
protected parse(array $tokens): boolThe parser reads declaration modifiers, class name, inheritance, implemented interfaces, and then walks the class body to collect properties, constants, methods, and promoted constructor properties.
Parameters
| Parameter | Type | Description |
|---|---|---|
$tokens | array | token stream passed by reference with the internal pointer used for parsing |
parseClassSignature
Parses the class signature, including the class name, extends clause,.
protected parseClassSignature(array $tokens): voidParameters
| Parameter | Type | Description |
|---|---|---|
$tokens | array | token stream passed by reference with the internal pointer used for parsing |
parseClassBody
Parses the class body to extract properties, constants, methods, and promoted constructor properties.
protected parseClassBody(array $tokens): boolParameters
| 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