Skip to content

Releases: nikic/PHP-Parser

PHP-Parser 4.13.1

03 Nov 20:55
Compare
Choose a tag to compare

Fixed

  • Support reserved keywords as enum cases.
  • Support array unpacking in constant expression evaluator.

PHP-Parser 4.13.0

20 Sep 12:25
Compare
Choose a tag to compare

This release features full PHP 8.1 support.

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.

PHP-Parser 4.12.0

21 Jul 10:49
Compare
Choose a tag to compare

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.

PHP-Parser 4.11.0

03 Jul 13:38
Compare
Choose a tag to compare

Added

  • BuilderFactory::args() now accepts named arguments.
  • BuilderFactory::attribute() has been added.
  • An addAttribute() method accepting an Attribute or AttributeGroup has been added to all builders that accept attributes, such as Builder\Class_.

Fixed

  • NameResolver now handles enums.
  • PrettyPrinter now prints backing enum type.
  • Builder methods for types now property handle never type.

PHP-Parser 4.10.5

03 May 19:17
Compare
Choose a tag to compare

Added

  • [PHP 8.1] Added support for enums. These are represented using the Stmt\Enum_ and Stmt\EnumCase nodes.
  • [PHP 8.1] Added support for never type. This type will now be returned as an Identifier rather than Name.
  • Added ClassConst builder.

Changed

  • Non-UTF-8 code units in strings will now be hex-encoded.

Fixed

  • Fixed precedence of arrow functions.

PHP-Parser 4.10.4

20 Dec 10:02
Compare
Choose a tag to compare

Fixed

  • Fixed position information for variable-variables (#741).
  • Fixed position information for traits/interfaces preceded by if statement (#738).

PHP-Parser 4.10.3

03 Dec 17:47
Compare
Choose a tag to compare

Fixed

  • Fixed formatting-preserving pretty printing for "{$x}".
  • Ternary expressions are now treated as non-associative in the pretty printer, in order to generate code that is compatible with the parentheses requirement introduced in PHP 8.
  • Removed no longer necessary error_clear_last() call in lexer, which may interfere with fatal error handlers if invoked during shutdown.

PHP-Parser 4.10.2

26 Sep 10:38
Compare
Choose a tag to compare

Fixed

  • Fixed check for token emulation conflicts with other libraries.

PHP-Parser 4.10.1

23 Sep 18:25
Compare
Choose a tag to compare

Added

  • Added support for recovering from a missing semicolon after a property or class constant declaration.

Fixed

  • Fix spurious whitespace in formatting-preserving pretty printer when both removing and adding elements at the start of a list.
  • Fix incorrect case-sensitivity in keyword token emulation.

PHP-Parser 4.10.0

19 Sep 14:54
Compare
Choose a tag to compare

Added

  • [PHP 8.0] Added support for attributes. These are represented using a new AttributeGroup node containing Attribute nodes. A new attrGroups subnode is available on all node types that support attributes, i.e. Stmt\Class_, Stmt\Trait_, Stmt\Interface_, Stmt\Function_, Stmt\ClassMethod, Stmt\ClassConst, Stmt\Property, Expr\Closure, Expr\ArrowFunction and Param.
  • [PHP 8.0] Added support for nullsafe properties inside interpolated strings, in line with an upstream change.

Fixed

  • Improved compatibility with other libraries that use forward compatibility defines for PHP tokens.