ParserClass
ParserClass
Parses class declarations from a token stream.
class ParserClass extends \Hazaar\Parser\PHP\TokenParserExtends: Hazaar\Parser\PHP\TokenParser
This 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 $abstractType: bool
extends
public string $extendsType: string
implements
Fully-qualified interface names from the implements clause.
public array $implementsType: array
extendsLink
public string $extendsLinkType: string
implementsLink
$implements entries, each as a [FQCN](https://www.php.net/manual/en/class.fqcn.php) class-link marker.
public array $implementsLinkType: array
Computed by Documentor after parsing; empty until then.
properties
Class properties declared directly in the class body and via
public array $propertiesType: array
constructor property promotion.
methods
Methods declared by the class.
public array $methodsType: array
constants
Class constants declared in the class body.
public array $constantsType: array
parserObjectType
Token type this parser recognises as the object declaration keyword.
protected int $parserObjectType = 'T_CLASS'Type: int
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): boolReturns: bool
The 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): voidReturns: void
Parameters
| 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): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$tokens | array | token stream passed by reference with the internal pointer used for parsing |
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:16 +0000