From 829c6c3c7143fcc4c74d751ed84931e238ec8dae Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 2 Sep 2017 20:03:10 +0200 Subject: [PATCH] Add initial changelog for version 4.0 --- CHANGELOG.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 3 +-- UPGRADE-4.0.md | 4 +++- 3 files changed, 62 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fd7b09..1ec5904 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,61 @@ +Version 4.0.0-dev +----------------- + +### Added + +* Added experimental support for format-preserving prettying. 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 convertion 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. + +### 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. + Version 3.1.2-dev ----------------- diff --git a/README.md b/README.md index a915c04..7b0a28b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ PHP Parser This is a PHP 5.2 to PHP 7.1 parser written in PHP. Its purpose is to simplify static code analysis and manipulation. -[**Documentation for version 3.x**][doc_3_x] (stable; for running on PHP >= 5.5; for parsing PHP 5.2 to PHP 7.1). +[**Documentation for version 3.x**][doc_3_x] (stable; for running on PHP >= 5.5; for parsing PHP 5.2 to PHP 7.2). [Documentation for version 2.x][doc_2_x] (unsupported; for running on PHP >= 5.4; for parsing PHP 5.2 to PHP 7.0). @@ -93,7 +93,6 @@ Component documentation: 1. [Error handling](doc/component/Error_handling.markdown) 2. [Lexer](doc/component/Lexer.markdown) - [doc_1_x]: https://github.com/nikic/PHP-Parser/tree/1.x/doc [doc_2_x]: https://github.com/nikic/PHP-Parser/tree/2.x/doc [doc_3_x]: https://github.com/nikic/PHP-Parser/tree/3.x/doc [doc_master]: https://github.com/nikic/PHP-Parser/tree/master/doc diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index 4bb4862..3889555 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -64,4 +64,6 @@ Because HHVM does not support PHP 7, HHVM is no longer supported. * 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. \ No newline at end of file + `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. \ No newline at end of file