Parser.php 628 B

123456789101112131415161718
  1. <?php declare(strict_types=1);
  2. namespace PhpParser;
  3. interface Parser
  4. {
  5. /**
  6. * Parses PHP code into a node tree.
  7. *
  8. * @param string $code The source code to parse
  9. * @param ErrorHandler|null $errorHandler Error handler to use for lexer/parser errors, defaults
  10. * to ErrorHandler\Throwing.
  11. *
  12. * @return Node\Stmt[]|null Array of statements (or null non-throwing error handler is used and
  13. * the parser was unable to recover from an error).
  14. */
  15. public function parse(string $code, ErrorHandler $errorHandler = null);
  16. }