Skip to content

Releases: nikic/PHP-Parser

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.

PHP-Parser 4.9.1

30 Aug 16:18
Compare
Choose a tag to compare

Added

  • Added support for removing the first element of a list to the formatting-preserving pretty printer.

Fixed

  • Allow member modifiers as part of namespaced names. These were missed when support for other keywords was added.

PHP-Parser 4.9.0

18 Aug 19:51
Compare
Choose a tag to compare

Added

  • [PHP 8.0] Added support for named arguments, represented using a new name subnode on Arg.
  • [PHP 8.0] Added support for static return type, represented like a normal class return type.
  • [PHP 8.0] Added support for throw expression, represented using a new Expr\Throw_ node. For backwards compatibility reasons, throw expressions in statement context continue to be represented using Stmt\Throw_.
  • [PHP 8.0] Added support for keywords as parts of namespaced names.

Fixed

  • Emit parentheses for class constant fetch with complex left-hand-side.
  • Emit parentheses for new/instanceof on complex class expression.

PHP-Parser 4.8.0

09 Aug 10:24
Compare
Choose a tag to compare

Added

  • [PHP 8.0] Added support for nullsafe operator, represented using the new Expr\NullsafePropertyFetch and Expr\NullsafeMethodCall nodes.
  • Added phpVersion option to the emulative lexer, which allows controlling the target version to emulate (defaults to the latest available, currently PHP 8.0). This is useful to parse code that uses reserved keywords from newer PHP versions as identifiers.

PHP-Parser 4.7.0

25 Jul 13:23
Compare
Choose a tag to compare

Added

  • Add ParentConnectingVisitor and NodeConnectingVisitor classes.
  • [PHP 8.0] Added support for match expressions. These are represented using a new Expr\Match_ containing MatchArms.
  • [PHP 8.0] Added support for trailing comma in closure use lists.

Fixed

  • Fixed missing error for unterminated comment with trailing newline (#688).
  • Compatibility with PHP 8.0 has been restored: Namespaced names are now always represented by T_NAME_* tokens, using emulationg on older PHP versions. Full support for reserved keywords in namespaced names is not yet present.

PHP-Parser 4.6.0

02 Jul 17:17
Compare
Choose a tag to compare

Added

  • [PHP 8.0] Added support for trailing commas in parameter lists.
  • [PHP 8.0] Added support for constructor promotion. The parameter visibility is stored in Node\Param::$flags.

Fixed

  • Comment tokens now always follow the PHP 8 interpretation, and do not include trailing whitespace.
  • As a result of the previous change, some whitespace issues when inserting a statement into a method containing only a comment, and using the formatting-preserving pretty printer, have been resolved.

PHP-Parser 4.5.0

03 Jun 07:26
Compare
Choose a tag to compare

Added

  • [PHP 8.0] Added support for the mixed type. This means mixed types are now parsed as an Identifier rather than a Name.
  • [PHP 8.0] Added support for catching without capturing the exception. This means that Catch_::$var may now be null.

PHP-Parser 4.4.0

10 Apr 16:39
Compare
Choose a tag to compare

Added

  • Added support for passing union types in builders.
  • Added end line, token position and file position information for comments.
  • Added getProperty() method to ClassLike nodes.
  • [PHP 8.0] Add support for variable syntax tweaks RFC.

Fixed

  • Fixed generation of invalid code when using the formatting preserving pretty printer, and inserting code next to certain nop statements. The formatting is still ugly though.
  • getDocComment() no longer requires that the very last comment before a node be a doc comment. There may not be non-doc comments between the doc comment and the declaration.
  • Allowed arbitrary expressions in isset() and list(), rather than just variables. In particular, this allows isset(($x)), which is legal PHP code.

PHP-Parser 4.3.0

10 Apr 16:38
Compare
Choose a tag to compare

Added

  • [PHP 8.0] Added support for union types using a new UnionType node.