PHP Parser v5.0.0-alpha1 Release Notes

Release Date: 2022-09-04 // over 1 year 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 for Stmt\Class_::MODIFIER_*.
    • โž• Added support for returning an array or REMOVE_NODE from NodeVisitor::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.