NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist · #13 most downloaded on Packagist
A PHP parser written in PHP
Last release 20 days ago
13 Sep 2026
Release timing varies
gaps range from 9 days to 7 months
Most releases are documented
notes for 42 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
15 years old
113 releases · first in 2012
Fixed possible undefined offset notice in formatting-preserving printer.
Improved error recovery inside classes.
foreach without as.function (Type ) {}).function ($foo)).One column per quarter.
[PHP 7.3] Added support for trailing commas in function calls.
BuilderFactory, to simplify creation of expressions:
funcCall()methodCall()staticCall()new()constFetch()classConstFetch()No significant code changes since the beta 1 release.
Fixed duplicate comment assignment in switch statements.
Fixed pretty printing of -(-$x) and +(+$x).
-(-$x) and +(+$x). (#459)Improve compatibility with php-scoper, by supporting prefixed namespaces in NodeAbstract::getType().
NodeAbstract::getType().Comments on empty blocks are now preserved on a Stmt\Nop node.
Stmt\Nop node. (#382)kind attribute for Stmt\Namespace_ node, which is one of KIND_SEMICOLON or
KIND_BRACED. (#417)setDocComment() method to namespace builder. (#437)Fixed syntax error on comment after brace-style namespace declaration.
Name::$parts is no longer deprecated.
object type. This means object types will now be represented as a
builtin type (a simple "object" string), rather than a class Name.Name::$parts is no longer deprecated.The Node::setLine() method has been deprecated.
Class_::VISIBILITY_MODIFIER_MASK. The previous spelling of
Class_::VISIBILITY_MODIFER_MASK is preserved for backwards compatibility.Builder\Param::makeVariadic().Node::setLine() method has been deprecated.Name resolution of NullableTypes is now performed earlier, so that a fully resolved signature is available when a function is entered.
NullableTypes is now performed earlier, so that a fully resolved signature is
available when a function is entered. (#360)Error nodes are now considered empty, while previously they extended until the token where the
error occurred. This made some nodes larger than expected. (#359)Fixed some extensibility issues in pretty printer (pUseType() is now public and pPrec() calls into p(), instead of directly dispatching to the type-sp
pUseType() is now public and pPrec() calls
into p(), instead of directly dispatching to the type-specific printing method).bin/php-parse script.The XML serializer has been deprecated. In particular, the classes Serializer\XML, Unserializer\XML, as well as the interfaces Serializer and Unserial…
"$foo[0]" the 0 is now parsed as an LNumber rather than String. (#325)LogicException when trying to pretty-print an Error node. Previously this resulted in
an undefined method exception or fatal error."$foo[-1]"preserveOriginalNames option to NameResolver. If this option is enabled, an
originalName attribute, containing the unresolved name, will be added to each resolved name.php-parse --with-positions option, which dumps nodes with position information.Serializer\XML,
Unserializer\XML, as well as the interfaces Serializer and Unserializer are deprecated.Fixed name resolution of nullable types.
Fixed handling of nested list()s: If the nested list was unkeyed, it was directly included in the list items. If it was keyed, it was wrapped in Array
list()s: If the nested list was unkeyed, it was directly included in
the list items. If it was keyed, it was wrapped in ArrayItem. Now nested List_ nodes are
always wrapped in ArrayItems. (#321)Added support for dumping node positions in the NodeDumper through the dumpPositions option.
dumpPositions option.$, new, Foo::.The pretty printer will now escape all control characters in the range \x00-\x1F inside double quoted strings. If no special escape sequence is availa
\x00-\x1F inside double
quoted strings. If no special escape sequence is available, an octal escape will be used.$var =& new Obj assignments.The Comment::setLine() and Comment::setText() methods have been deprecated. Construct new objects instead.
B"" strings (with uppercase B) in a number of places.dumpComments option to node dumper, to enable dumping of comments associated with nodes.Stmt\Nop node, that is used to collect comments located at the end of a block or at the
end of a file (without a following node with which they could otherwise be associated).kind attribute to Expr\Exit to distinguish between exit and die.kind attribute to Scalar\LNumber to distinguish between decimal, binary, octal and
hexadecimal numbers.kind attribute to Expr\Array to distinguish between array() and [].kind attribute to Scalar\String and Scalar\Encapsed to distinguish between
single-quoted, double-quoted, heredoc and nowdoc string.docLabel attribute to Scalar\String and Scalar\Encapsed, if it is a heredoc or
nowdoc string.Comment nodes.setReturnType() method to function and method builders.-h and --help options to php-parse script.AbstractPrettyPrinter::pComments() method no longer returns a trailing newline.PhpParser for easier downstream distribution.Comment::setLine() and Comment::setText() methods have been deprecated. Construct new
objects instead.Scalar\LNumber::parse() has been removed. A non-internal
LNumber::fromString() method has been added instead.declare() {} and declare(); are not semantically equivalent and will now result in different ASTs. The format case will have an empty stmts array, whi
declare() {} and declare(); are not semantically equivalent and will now result in different
ASTs. The format case will have an empty stmts array, while the latter will set stmts to
null.#!/usr/bin/env php is now allowed at the start of a namespaced file.
Previously this generated an exception.prettyPrintFile() method will not strip a trailing ?> from the raw data that follows a
__halt_compiler() statement.prettyPrintFile() method will not strip an opening <?php if the file starts with a
comment followed by InlineHTML.String parts of encapsed strings are now represented using Scalar\EncapsStringPart nodes. Previously raw strings were used. This affects the parts chi
Scalar\EncapsStringPart nodes.
Previously raw strings were used. This affects the parts child of Scalar\Encaps and
Expr\ShellExec. The change has been done to allow assignment of attributes to encapsed string
parts.Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →