\PhpParserParser

Summary

Methods
Constants
parse()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

parse()

parse(string  $code, \PhpParser\ErrorHandler|null  $errorHandler = null) : array<mixed,\PhpParser\Node>|null

Parses PHP code into a node tree.

Parameters

string $code

The source code to parse

\PhpParser\ErrorHandler|null $errorHandler

Error handler to use for lexer/parser errors, defaults to ErrorHandler\Throwing.

Returns

array<mixed,\PhpParser\Node>|null —

Array of statements (or null if the 'throwOnError' option is disabled and the parser was unable to recover from an error).