github nikic/PHP-Parser v5.0.0beta1
PHP-Parser 5.0.0 Beta 1

latest releases: v5.3.1, v4.19.4, v4.19.3...
pre-release13 months ago

See UPGRADE-5.0 for detailed migration instructions. The changelog is relative to alpha 3.

Added

  • Visitors can now be passed directly to the NodeTraverser constructor. A separate call to addVisitor() is no longer required.

Changed

  • The minimum host PHP version is now PHP 7.4. It is still possible to parse code from older versions. Property types have been added where possible.
  • The Lexer no longer accepts options. Lexer\Emulative only accepts a PhpVersion. The startLexing(), getTokens() and handleHaltCompiler() methods have been removed. Instead, there is a single method tokenize() returning the tokens.
  • The Parser::getLexer() method has been replaced by Parser::getTokens().
  • Attribute handling has been moved from the lexer to the parser, and is no longer configurable. The comments, startLine, endLine, startTokenPos, endTokenPos, startFilePos, and endFilePos attributes will always be added.
  • The pretty printer now defaults to PHP 7.4 as the target version.
  • The pretty printer now indents heredoc/nowdoc strings if the target version is >= 7.3 (flexible heredoc/nowdoc).

Removed

  • The deprecated Comment::getLine(), Comment::getTokenPos() and Comment::getFilePos() methods have been removed. Use Comment::getStartLine(), Comment::getStartTokenPos() and Comment::getStartFilePos() instead.

Deprecated

  • The Node::getLine() method has been deprecated. Use Node::getStartLine() instead.

Don't miss a new PHP-Parser release

NewReleases is sending notifications on new releases.