PHP Parser v5.0.0-alpha1 Release Notes
Release Date: 2022-09-04 // about 3 years ago-
โฌ๏ธ See UPGRADE-5.0 for detailed migration instructions.
๐ Changed
- ๐ PHP 7.1 is now required to run PHP-Parser.
- ๐จ Formatting of the standard pretty printer has been adjusted to match PSR-12 more closely.
- ๐ The internal token representation now uses a
PhpParser\Tokenclass, which is compatible with PHP 8 token representation (PhpToken). - Destructuring is now always represented using
Expr\List_nodes, even if it uses[]syntax. - ๐ Renamed a number of node classes, and moved things that were not real expressions/statements
outside the
Expr/Stmthierarchy. Compatibility shims for the old names have been retained.
โ Added
- โ Added
PhpVersionclass, which is accepted in a number of places (e.g. ParserFactory, Parser, Lexer, PrettyPrinter) and gives more precise control over the PHP version being targeted. - โ Added PHP 8 parser though it only differs from the PHP 7 parser in concatenation precedence.
- โ Added
Parser::getLexer()method. - Added a
Modifiersclass, as a replacement forStmt\Class_::MODIFIER_*. - โ Added support for returning an array or
REMOVE_NODEfromNodeVisitor::enterNode().
โ Removed
- ๐ The PHP 5 parser has been removed. The PHP 7 parser has been adjusted to deal with PHP 5 code more gracefully.
Previous changes from v4.15.0
-
โ Added
- ๐ PHP 8.2: Added support for
truetype. - ๐ PHP 8.2: Added support for DNF types.
๐ Fixed
- ๐ Support
readonlyas a function name. - Added
__serializeand__unserializeto magic method list. - ๐ Fixed bounds check in
Name::slice(). - ๐ Fixed formatting preservation when adding attributes to a class/method/etc that previously had none.
- ๐ PHP 8.2: Added support for