PHP-Parser 5.0.0 Beta 1
Pre-release
Pre-release
See UPGRADE-5.0 for detailed migration instructions. The changelog is relative to alpha 3.
Added
- Visitors can now be passed directly to the
NodeTraverserconstructor. A separate call toaddVisitor()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
Lexerno longer accepts options.Lexer\Emulativeonly accepts aPhpVersion. ThestartLexing(),getTokens()andhandleHaltCompiler()methods have been removed. Instead, there is a single methodtokenize()returning the tokens. - The
Parser::getLexer()method has been replaced byParser::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()andComment::getFilePos()methods have been removed. UseComment::getStartLine(),Comment::getStartTokenPos()andComment::getStartFilePos()instead.
Deprecated
- The
Node::getLine()method has been deprecated. UseNode::getStartLine()instead.