Skip to content

Releases: nikic/PHP-Parser

PHP-Parser 5.7.0

06 Dec 11:57

Choose a tag to compare

Fixed

  • Fixed changing modifier on anonymous class with formatting preserving pretty printer.
  • Emit an error for unparenthesized arrow functions in pipe operator, and print necessary parentheses in the pretty printer.
  • Fix PHP 8.5 deprecation warning in php-parse binary.

Changed

  • When targeting PHP 8.4 or newer, omit parentheses around immediately dereferenced new expressions.

Added

  • Added shouldPrintRawValue attribute to Scalar\Int_, which makes the pretty printer use the rawValue of the node. This can be used to print integers with separators.

PHP-Parser 4.19.5

06 Dec 11:46

Choose a tag to compare

Fixed

  • Fixed deprecation warnings on PHP 8.5.

PHP-Parser 5.6.2

21 Oct 19:33

Choose a tag to compare

Fixed

  • Fixed formatting-preserving pretty-printing when changing the visibility modifier on a node that has attributes.
  • Fixed chr() deprecation warning on PHP 8.5.

Added

  • Added Param::isFinal() method.

PHP-Parser 5.6.1

13 Aug 20:15

Choose a tag to compare

Fixed

  • Fixed Param::isPublic() for parameters with asymmetric visibility keyword.
  • Fixed PHP 8.5 deprecation warnings for SplObjectStorage methods.

Added

  • Added cast kind attributes to Cast\Int_, Cast\Bool_ and Cast\String_. These allow distinguishing the deprecated versions of these casts.

PHP-Parser 5.6.0

27 Jul 20:05

Choose a tag to compare

Added

  • [8.5] Added support for clone with arbitrary function arguments. This will be parsed as an Expr\FuncCall node, instead of the usual Expr\Clone_ node.
  • [8.5] Permit declaration of function clone for use in stubs.
  • [8.5] Added support for the pipe operator, represented by Expr\BinaryOp\Pipe.
  • [8.5] Added support for the (void) cast, represented by Expr\Cast\Void_.
  • [8.5] Added support for the final modifier on promoted properties.
  • Added CallLike::getArg() to fetch an argument by position and name.

PHP-Parser 5.5.0

31 May 08:26

Choose a tag to compare

Added

  • [8.5] Added support for attributes on constants. Stmt\Const_ now has an attrGroups subnode.
  • Added weakReferences option to NodeConnectingVisitor and ParentConnectingVisitor. This will create the parent/next/prev references as WeakReferences, to avoid making the AST cyclic and thus increasing GC pressure.

Changed

  • Attributes on parameters are now printed on separate lines if the pretty printer target version is PHP 7.4 or older (which is the default). This allows them to be interpreted as comments, instead of causing a parse error. Specify a target version of PHP 8.0 or newer to restore the previous behavior.

PHP-Parser 5.4.0

30 Dec 11:10

Choose a tag to compare

Added

  • Added Property::isAbstract() and Property::isFinal() methods.
  • Added PropertyHook::isFinal() method.
  • Emit an error if property hook is used on declaration with multiple properties.

Fixed

  • Make legacy class aliases compatible with classmap-authoritative autoloader.
  • Param::isPromoted() and Param::isPublic() now returns true for parameters that have property hooks but no explicit visibility modifier.
  • PropertyHook::getStmts() now correctly desugars short set hooks. set => $value will be expanded to set { $this->propertyName = $value; }. This requires the propertyName attribute on the hook to be set, which is now also set by the parser. If the attribute is not set, getStmts() will throw an error for short set hooks, as it is not possible to produce a correct desugaring.

PHP-Parser 5.3.1

08 Oct 18:52

Choose a tag to compare

Added

  • Added support for declaring functions with name exit or die, to allow their use in stubs.

PHP-Parser 5.3.0

29 Sep 13:59

Choose a tag to compare

Added

  • Added indent option to pretty printer, which can be used to specify the indentation to use (defaulting to four spaces). This also allows using tab indentation.

Fixed

  • Resolve names in PropertyHooks in the NameResolver.
  • Include the trailing semicolon inside Stmt\GroupUse nodes, making them consistent with Stmt\Use_ nodes.
  • Fixed indentation sometimes becoming negative in formatting-preserving pretty printer, resulting in ValueErrors.

PHP-Parser 4.19.4

29 Sep 15:03

Choose a tag to compare

Fixed

  • Remove the Parser\Php8 class from PHP-Parser 5.x that was mistakenly added. It could cause errors when using something like composer preload.