PHP Interface PhpParser\Parser

Show file Open project: nikic/php-parser Interface Usage Examples

Public Methods

Method Description
parse ( string $code, phpparser\ErrorHandler $errorHandler = null ) : phpparser\Node[] | null Parses PHP code into a node tree.

Method Details

parse() public method

Parses PHP code into a node tree.
public parse ( string $code, phpparser\ErrorHandler $errorHandler = null ) : phpparser\Node[] | null
$code string The source code to parse
$errorHandler phpparser\ErrorHandler Error handler to use for lexer/parser errors, defaults to ErrorHandler\Throwing.
return phpparser\Node[] | null Array of statements (or null if the 'throwOnError' option is disabled and the parser was unable to recover from an error).