PHP Parser v4.13.0 Release Notes

Release Date: 2021-09-20 // 3 months ago
  • โž• Added

    • ๐Ÿ‘ [PHP 8.1] Added support for intersection types using a new IntersectionType node. Additionally a ComplexType parent class for NullableType, UnionType and IntersectionType has been added.
    • ๐Ÿ‘ [PHP 8.1] Added support for explicit octal literals.
    • ๐Ÿ‘ [PHP 8.1] Added support for first-class callables. These are represented using a call whose first argument is a VariadicPlaceholder. The representation is intended to be forward-compatible with partial function application, just like the PHP feature itself. Call nodes now extend from Expr\CallLike, which provides an isFirstClassCallable() method to determine whether a placeholder id present. getArgs() can be used to assert that the call is not a first-class callable and returns Arg[] rather than array<Arg|VariadicPlaceholder>.

    ๐Ÿ›  Fixed

    • Multiple modifiers for promoted properties are now accepted. In particular this allows something like public readonly for promoted properties.
    • ๐Ÿ–จ Formatting-preserving pretty printing for comments in array literals has been fixed.

Previous changes from v4.12.0

  • โž• Added

    • ๐Ÿ‘ [PHP 8.1] Added support for readonly properties (through a new MODIFIER_READONLY).
    • ๐Ÿ‘ [PHP 8.1] Added support for final class constants.

    ๐Ÿ›  Fixed

    • ๐Ÿ›  Fixed compatibility with PHP 8.1. & tokens are now canonicalized to the T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG and T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG tokens used in PHP 8.1. This happens unconditionally, regardless of whether the emulative lexer is used.