Php-parser-py

Latest version: v1.2.2

Safety actively analyzes 874069 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 14

5.7.0

--------------------------

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.

5.6.2

--------------------------

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.

5.6.1

--------------------------

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.

5.6.0

--------------------------

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.

5.5.0

--------------------------

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.

5.4.0

--------------------------

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.

Page 1 of 14

© 2026 Safety CLI Cybersecurity Inc. All Rights Reserved.