All Versions
64
Latest Version
Avg Release Cycle
43 days
Latest Release
1014 days ago

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 of Stmt\Property. Additionally Builder\Property now has a setType() method. (#567)
    • โž• Add kind attribute to Cast\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).
  • v4.1.1 Changes

    December 26, 2018

    ๐Ÿ›  Fixed

    • ๐Ÿ›  Fix "undefined offset" notice when parsing specific malformed code (#551).

    โž• Added

    • ๐Ÿ‘Œ Support error recovery for missing return type (function foo() : {}) (#544).
  • 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 to NodeTraverser to skip both traversal of child nodes, and prevent subsequent visitors from visiting the current node.
  • 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 introduced Builder\Param::setType().
  • 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 without as.
    • ๐Ÿ‘Œ 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 to NameResolver, defaulting to true. If this option is disabled, resolved names will be added as resolvedName 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 the NameResolver 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 methods toLowerString() and isSpecialClassName().
    • โž• Added Identifier and VarLikeIdentifier nodes, which are used in place of simple strings in many places.
    • โž• Added getComments(), getStartLine(), getEndLine(), getStartTokenPos(), getEndTokenPos(), getStartFilePos() and getEndFilePos() methods to Node. 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 + for Expr\BinaryOp\Plus, etc.
    • โž• Added start token offsets to comments.

    ๐Ÿ”„ Changed

    • โฌ†๏ธ Many subnodes that previously held simple strings now use Identifier (or VarLikeIdentifier) 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 a Stmt\Expression node. Previously these statements were directly represented as their constituent expression.
    • The name subnode of Param has been renamed to var and now contains a Variable rather than a plain string.
    • The name subnode of StaticVar has been renamed to var and now contains a Variable rather than a plain string.
    • The var subnode of ClosureUse now contains a Variable rather than a plain string.
    • The var subnode of Catch now contains a Variable rather than a plain string.
    • The alias subnode of UseUse is now null if no explicit alias is given. As such, use Foo\Bar and use Foo\Bar as Bar are now represented differently. The getAlias() 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 on Class, ClassMethod and Property nodes. Use flags instead.
    • ๐Ÿšš The ClassConst::isStatic() method has been removed. Constants cannot have a static modifier.
    • ๐Ÿšš The NodeTraverser no longer accepts false as a return value from a leaveNode() method. NodeTraverser::REMOVE_NODE should be returned instead.
    • ๐Ÿšš The Node::setLine() method has been removed. If you really need to, you can use setAttribute() instead.
    • The misspelled Class_::VISIBILITY_MODIFER_MASK constant has been dropped in favor of Class_::VISIBILITY_MODIFIER_MASK.
    • ๐Ÿšš The XML serializer has been removed. As such, the classes Serializer\XML, and Unserializer\XML, as well as the interfaces Serializer and Unserializer no longer exist.
    • ๐Ÿ— The BuilderAbstract class has been removed. It's functionality is moved into BuilderHelpers. 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.