All Versions
64
Latest Version
Avg Release Cycle
43 days
Latest Release
1014 days ago
Changelog History
Page 4
Changelog History
Page 4
-
v4.2.0 Changes
January 12, 2019โ Added
- ๐ [PHP 7.4] Add support for typed properties through a new
type
subnode ofStmt\Property
. AdditionallyBuilder\Property
now has asetType()
method. (#567) - โ Add
kind
attribute toCast\Double_
, which allows to distinguish between(float)
,(double)
and(real)
. The form of the cast will be preserved by the pretty printer. (#565)
๐ Fixed
- โ Remove assertion when pretty printing anonymous class with a name (#554).
- ๐ [PHP 7.4] Add support for typed properties through a new
-
v4.1.1 Changes
December 26, 2018 -
v4.1.0 Changes
October 10, 2018โ Added
- โ Added support for PHP 7.3 flexible heredoc/nowdoc strings, completing support for PHP 7.3. There
are two caveats for this feature:
- In some rare, pathological cases flexible heredoc/nowdoc strings change the interpretation of existing doc strings. PHP-Parser will now use the new interpretation.
- Flexible heredoc/nowdoc strings require special support from the lexer. Because this is not available on PHP versions before 7.3, support has to be emulated. This emulation is not perfect and some cases which we do not expect to occur in practice (such as flexible doc strings being nested within each other through abuse of variable-variable interpolation syntax) may not be recognized correctly.
- Added
DONT_TRAVERSE_CURRENT_AND_CHILDREN
toNodeTraverser
to skip both traversal of child nodes, and prevent subsequent visitors from visiting the current node.
- โ Added support for PHP 7.3 flexible heredoc/nowdoc strings, completing support for PHP 7.3. There
are two caveats for this feature:
-
v4.0.4 Changes
September 18, 2018โ Added
- ๐ The following methods have been added to
BuilderFactory
:useTrait()
(fluent builder)traitUseAdaptation()
(fluent builder)useFunction()
(fluent builder)useConst()
(fluent builder)var()
propertyFetch()
๐ Deprecated
- ๐
Builder\Param::setTypeHint()
has been deprecated in favor of the newly introducedBuilder\Param::setType()
.
- ๐ The following methods have been added to
-
v4.0.3 Changes
July 15, 2018๐ Fixed
- ๐ Fixed possible undefined offset notice in formatting-preserving printer. (#513)
โ Added
- ๐ Improved error recovery inside arrays.
- Preserve trailing comment inside classes. Note: This change is possibly BC breaking if your code validates that classes can only contain certain statement types. After this change, classes can also contain Nop statements, while this was not previously possible. (#509)
-
v4.0.2 Changes
June 03, 2018โ Added
- ๐ Improved error recovery inside classes.
- ๐ Support error recovery for
foreach
withoutas
. - ๐ Support error recovery for parameters without variable (
function (Type ) {}
). - ๐ Support error recovery for functions without body (
function ($foo)
).
-
v4.0.1 Changes
March 25, 2018โ Added
- ๐ [PHP 7.3] Added support for trailing commas in function calls.
- ๐ [PHP 7.3] Added support for by-reference array destructuring.
- โ Added checks to node traverser to prevent replacing a statement with an expression or vice versa. This should prevent common mistakes in the implementation of node visitors.
- โ Added the following methods to
BuilderFactory
, to simplify creation of expressions:funcCall()
methodCall()
staticCall()
new()
constFetch()
classConstFetch()
-
v4.0.0 Changes
February 28, 2018๐ This is a new major version of the PHP-Parser library. The biggest new feature in this release is an experimental pretty-printing mode, which preserves formatting for parts of the code which have not been modified. As such, it should now be much easier to use PHP-Parser for automated code refactorings. See the pretty printer documentation for information on how to use this functionality
โฌ๏ธ The following changelog lists all significant changes relative to PHP-Parser 3.1. For more information on backwards incompatible changes, please see the upgrading guide.
โ Added
- โ Added experimental support for format-preserving pretty-printing. In this mode formatting will be preserved for parts of the code which have not been modified.
- โ Added
replaceNodes
option toNameResolver
, defaulting to true. If this option is disabled, resolved names will be added asresolvedName
attributes, instead of replacing the original names. - โ Added
NodeFinder
class, which can be used to find nodes based on a callback or class name. This is a utility to avoid custom node visitor implementations for simple search operations. - โ Added
ClassMethod::isMagic()
method. - โ Added
BuilderFactory
methods:val()
method for creating an AST for a simple value,concat()
for creating concatenation trees,args()
for preparing function arguments. - โ Added
NameContext
class, which encapsulates theNameResolver
logic independently of the actual AST traversal. This facilitates use in other context, such as class names in doc comments. Additionally it provides an API for getting the shortest representation of a name. - โ Added
Node::setAttributes()
method. - โ Added
JsonDecoder
. This allows conversion JSON back into an AST. - โ Added
Name
methodstoLowerString()
andisSpecialClassName()
. - โ Added
Identifier
andVarLikeIdentifier
nodes, which are used in place of simple strings in many places. - โ Added
getComments()
,getStartLine()
,getEndLine()
,getStartTokenPos()
,getEndTokenPos()
,getStartFilePos()
andgetEndFilePos()
methods toNode
. These provide a more obvious access point for the already existing attributes of the same name. - โ Added
ConstExprEvaluator
to evaluate constant expressions to PHP values. - โ Added
Expr\BinaryOp::getOperatorSigil()
, returning+
forExpr\BinaryOp\Plus
, etc. - โ Added start token offsets to comments.
๐ Changed
- โฌ๏ธ Many subnodes that previously held simple strings now use
Identifier
(orVarLikeIdentifier
) nodes. Please see the UPGRADE-4.0 file for an exhaustive list of affected nodes and some notes on possible impact. - Expression statements (
expr;
) are now represented using aStmt\Expression
node. Previously these statements were directly represented as their constituent expression. - The
name
subnode ofParam
has been renamed tovar
and now contains aVariable
rather than a plain string. - The
name
subnode ofStaticVar
has been renamed tovar
and now contains aVariable
rather than a plain string. - The
var
subnode ofClosureUse
now contains aVariable
rather than a plain string. - The
var
subnode ofCatch
now contains aVariable
rather than a plain string. - The
alias
subnode ofUseUse
is nownull
if no explicit alias is given. As such,use Foo\Bar
anduse Foo\Bar as Bar
are now represented differently. ThegetAlias()
method can be used to get the effective alias, even if it is not explicitly given.
โ Removed
- ๐ Support for running on PHP 5 and HHVM has been removed. You can however still parse code of old PHP versions (such as PHP 5.2), while running on PHP 7.
- โ Removed
type
subnode onClass
,ClassMethod
andProperty
nodes. Useflags
instead. - ๐ The
ClassConst::isStatic()
method has been removed. Constants cannot have a static modifier. - ๐ The
NodeTraverser
no longer acceptsfalse
as a return value from aleaveNode()
method.NodeTraverser::REMOVE_NODE
should be returned instead. - ๐ The
Node::setLine()
method has been removed. If you really need to, you can usesetAttribute()
instead. - The misspelled
Class_::VISIBILITY_MODIFER_MASK
constant has been dropped in favor ofClass_::VISIBILITY_MODIFIER_MASK
. - ๐ The XML serializer has been removed. As such, the classes
Serializer\XML
, andUnserializer\XML
, as well as the interfacesSerializer
andUnserializer
no longer exist. - ๐ The
BuilderAbstract
class has been removed. It's functionality is moved intoBuilderHelpers
. However, this is an internal class and should not be used directly. - ๐ The
Autoloader
class has been removed. It is now required to use the Composer autoloader.
-
v4.0.0-beta1 Changes
January 27, 2018๐ Fixed
- ๐จ In formatting-preserving pretty printer: Fixed indentation when inserting into lists. (#466)
โ Added
- ๐จ In formatting-preserving pretty printer: Improved formatting of elements inserted into multi-line arrays.
โ Removed
- ๐ The
Autoloader
class has been removed. It is now required to use the Composer autoloader.
-
v4.0.0-alpha3 Changes
December 26, 2017๐ Fixed
- ๐จ In the formatting-preserving pretty printer:
- Fixed comment indentation.
- Fixed handling of inline HTML in the fallback case.
- Fixed insertion into list nodes that require creation of a code block.
โ Added
- โ Added support for inserting at the start of list nodes in formatting-preserving pretty printer.
- ๐จ In the formatting-preserving pretty printer: