PHP Parser v5.0.0-alpha1 Release Notes
Release Date: 2022-09-04 // about 2 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\Token
class, 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
/Stmt
hierarchy. Compatibility shims for the old names have been retained.
โ Added
- โ Added
PhpVersion
class, 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
Modifiers
class, as a replacement forStmt\Class_::MODIFIER_*
. - โ Added support for returning an array or
REMOVE_NODE
fromNodeVisitor::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
true
type. - ๐ PHP 8.2: Added support for DNF types.
๐ Fixed
- ๐ Support
readonly
as a function name. - Added
__serialize
and__unserialize
to 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