Nothing yet.
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)pUseType() is now public and pPrec() calls
into p(), instead of directly dispatching to the type-specific printing method).bin/php-parse script."$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.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)dumpPositions option.$, new, Foo::.This release primarily improves our support for error recovery.
Node::setDocComment() method.Error::getMessageWithColumnInfo() method.ErrorHandler interface, and ErrorHandler\Throwing and ErrorHandler\Collecting as
specific implementations. These provide a general mechanism for handling error recovery.ErrorHandler argument to Parser::parse(), Lexer::startLexing() and
NameResolver::__construct().NameResolver now adds a namespacedName attribute on name nodes that cannot be statically
resolved (unqualified unaliased function or constant names in namespaces).
GroupUse prefix and variables in interpolated strings.NameTraverserInterface have been moved into the NameTraverser class.Parser interface and Lexer API have changed.~__EMU__~ sequences.
This changes the protected API of the lexer.Name::slice() method now returns null for empty slices, previously new Name([]) was
used. Name::concat() now also supports concatenation with null.Name::append() and Name::prepend(). These mutable methods have been superseded by
the immutable Name::concat().Error::getRawLine() and Error::setRawLine(). These methods have been superseded by
Error::getStartLine() and Error::setStartLine().NodeTraverser.$separator argument from Name::toString().throw_on_error parser option and Parser::getErrors() method. Use the ErrorHandler
mechanism instead.JsonSerializable. The node kind is stored in a nodeType
property.InlineHTML node now has an hasLeadingNewline attribute, that specifies whether the
preceding closing tag contained a newline. The pretty printer honors this attribute.$obj-> (with missing property name) is now supported in error recovery mode.php-parse script through the --with-recovery
or -r flags.The following changes are also part of PHP-Parser 2.1.1:
$var =& new Obj assignments.void and iterable types. These will now be represented as strings
(instead of Name instances) similar to other builtin types.ClassConst node now has a flags subnode
holding the visibility modifier, as well as isPublic(), isProtected() and isPrivate()
methods. The constructor changed to accept the additional subnode.NullableType node
with a single type subnode.Array nodes may now
appear as the left-hand-side of assignments and foreach value targets. Additionally the array
items may now contain null values if elements are skipped.List subnode vars has been renamed
to items and now contains ArrayItems instead of plain variables.Catch subnode type has been renamed to types and
is now an array of Names.Name::slice() now supports lengths and negative offsets. This brings it in line with
array_slice() functionality.Due to PHP 7.1 support additions described above, the node structure changed as follows:
void and iterable types are now stored as strings if the PHP 7 parser is used.ClassConst constructor changed to accept an additional flags subnode.Array subnode items may now contain null elements (destructuring).List subnode vars has been renamed to items and now contains ArrayItems instead of
plain variables.Catch subnode type has been renamed to types and is now an array of Names.Additionally the following changes were made:
type subnode on Class, ClassMethod and Property has been renamed to flags. The
type subnode has retained for backwards compatibility and is populated to the same value as
flags. However, writes to type will not update flags.TryCatch subnode finallyStmts has been replaced with a finally subnode that holds an
explicit Finally node. This allows for more accurate attribute assignment.Trait constructor now has the same form as the Class and Interface constructors: It
takes an array of subnodes. Unlike classes/interfaces, traits can only have a stmts subnode.NodeDumper now prints class/method/property/constant modifiers, as well as the include and
use type in a textual representation, instead of only showing the number.PrettyPrinter\Standard are now protected. Previoulsy most of them were public.Comment::setLine() and Comment::setText() methods have been removed.Name::set(), Name::setFirst() and Name::setLast() methods have been removed.\x00-\x1F inside double
quoted strings. If no special escape sequence is available, an octal escape will be used.$var =& new Obj assignments.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 attribtue 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, 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.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.php-parse.php to php-parse and registered it as a composer bin.shortArraySyntax option to pretty printer, to print all arrays using short syntax.A more detailed description of backwards incompatible changes can be found in the upgrading guide.
getSubNodeNames() method now.Stmt\GroupUse nodes. Furthermore a type
attribute was added to Stmt\UseUse to handle mixed group use declarations.'bool', 'int', 'float' and 'string'
as the type. The PHP 5 parser also accepts these, however they'll be Name instances there.PhpParser\ParserFactory class, which should be used to create parser instances.Name::concat() which concatenates two names.Name->slice() which takes a subslice of a name.PhpParser\Parser is now an interface, implemented by Parser\Php5, Parser\Php7 and
Parser\Multiple. The Multiple parser will try multiple parsers, until one succeeds.PhpParser\Parser\Tokens rather than PhpParser\Parser.Name->set(), Name->append(), Name->prepend() and Name->setFirst() methods are
deprecated in favor of Name::concat() and Name->slice().NodeTraverser no longer clones nodes by default. The old behavior can be restored by
passing true to the constructor.Scalar nodes no longer has a default value. E.g. new LNumber() should now
be written as new LNumber(0).This changelog only includes changes from the 2.0 series. For older changes see the 1.x series changelog and the 0.9 series changelog.