Parser
in
Table of Contents
Methods
- getTokens() : array<string|int, Token>
- Return tokens for the last parse.
- parse() : array<string|int, Stmt>|null
- Parses PHP code into a node tree.
Methods
getTokens()
Return tokens for the last parse.
public
getTokens() : array<string|int, Token>
Return values
array<string|int, Token>parse()
Parses PHP code into a node tree.
public
parse(string $code[, ErrorHandler|null $errorHandler = null ]) : array<string|int, Stmt>|null
Parameters
- $code : string
-
The source code to parse
- $errorHandler : ErrorHandler|null = null
-
Error handler to use for lexer/parser errors, defaults to ErrorHandler\Throwing.
Return values
array<string|int, Stmt>|null —Array of statements (or null non-throwing error handler is used and the parser was unable to recover from an error).