Parser.php 628 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace PhpParser;
  3. interface Parser {
  4. /**
  5. * Parses PHP code into a node tree.
  6. *
  7. * @param string $code The source code to parse
  8. *
  9. * @return Node[]|null Array of statements (or null if the 'throwOnError' option is disabled and the parser was
  10. * unable to recover from an error).
  11. */
  12. public function parse($code);
  13. /**
  14. * Get array of errors that occurred during the last parse.
  15. *
  16. * This method may only return multiple errors if the 'throwOnError' option is disabled.
  17. *
  18. * @return Error[]
  19. */
  20. public function getErrors();
  21. }