annotate vendor/nikic/php-parser/CHANGELOG.md @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 129ea1e6d783
children
rev   line source
Chris@17 1 Version 4.2.2-dev
Chris@0 2 -----------------
Chris@0 3
Chris@0 4 Nothing yet.
Chris@0 5
Chris@17 6 Version 4.2.1 (2019-02-16)
Chris@17 7 --------------------------
Chris@17 8
Chris@17 9 ### Added
Chris@17 10
Chris@17 11 * [PHP 7.4] Add support for `??=` operator through a new `AssignOp\Coalesce` node. (#575)
Chris@17 12
Chris@17 13 Version 4.2.0 (2019-01-12)
Chris@17 14 --------------------------
Chris@17 15
Chris@17 16 ### Added
Chris@17 17
Chris@17 18 * [PHP 7.4] Add support for typed properties through a new `type` subnode of `Stmt\Property`.
Chris@17 19 Additionally `Builder\Property` now has a `setType()` method. (#567)
Chris@17 20 * Add `kind` attribute to `Cast\Double_`, which allows to distinguish between `(float)`,
Chris@17 21 `(double)` and `(real)`. The form of the cast will be preserved by the pretty printer. (#565)
Chris@17 22
Chris@17 23 ### Fixed
Chris@17 24
Chris@17 25 * Remove assertion when pretty printing anonymous class with a name (#554).
Chris@17 26
Chris@17 27 Version 4.1.1 (2018-12-26)
Chris@17 28 --------------------------
Chris@17 29
Chris@17 30 ### Fixed
Chris@17 31
Chris@17 32 * Fix "undefined offset" notice when parsing specific malformed code (#551).
Chris@17 33
Chris@17 34 ### Added
Chris@17 35
Chris@17 36 * Support error recovery for missing return type (`function foo() : {}`) (#544).
Chris@17 37
Chris@17 38 Version 4.1.0 (2018-10-10)
Chris@17 39 --------------------------
Chris@17 40
Chris@17 41 ### Added
Chris@17 42
Chris@17 43 * Added support for PHP 7.3 flexible heredoc/nowdoc strings, completing support for PHP 7.3. There
Chris@17 44 are two caveats for this feature:
Chris@17 45 * In some rare, pathological cases flexible heredoc/nowdoc strings change the interpretation of
Chris@17 46 existing doc strings. PHP-Parser will now use the new interpretation.
Chris@17 47 * Flexible heredoc/nowdoc strings require special support from the lexer. Because this is not
Chris@17 48 available on PHP versions before 7.3, support has to be emulated. This emulation is not perfect
Chris@17 49 and some cases which we do not expect to occur in practice (such as flexible doc strings being
Chris@17 50 nested within each other through abuse of variable-variable interpolation syntax) may not be
Chris@17 51 recognized correctly.
Chris@17 52 * Added `DONT_TRAVERSE_CURRENT_AND_CHILDREN` to `NodeTraverser` to skip both traversal of child
Chris@17 53 nodes, and prevent subsequent visitors from visiting the current node.
Chris@17 54
Chris@17 55 Version 4.0.4 (2018-09-18)
Chris@17 56 --------------------------
Chris@17 57
Chris@17 58 ### Added
Chris@17 59
Chris@17 60 * The following methods have been added to `BuilderFactory`:
Chris@17 61 * `useTrait()` (fluent builder)
Chris@17 62 * `traitUseAdaptation()` (fluent builder)
Chris@17 63 * `useFunction()` (fluent builder)
Chris@17 64 * `useConst()` (fluent builder)
Chris@17 65 * `var()`
Chris@17 66 * `propertyFetch()`
Chris@17 67
Chris@17 68 ### Deprecated
Chris@17 69
Chris@17 70 * `Builder\Param::setTypeHint()` has been deprecated in favor of the newly introduced
Chris@17 71 `Builder\Param::setType()`.
Chris@17 72
Chris@17 73 Version 4.0.3 (2018-07-15)
Chris@17 74 --------------------------
Chris@17 75
Chris@17 76 ### Fixed
Chris@17 77
Chris@17 78 * Fixed possible undefined offset notice in formatting-preserving printer. (#513)
Chris@17 79
Chris@17 80 ### Added
Chris@17 81
Chris@17 82 * Improved error recovery inside arrays.
Chris@17 83 * Preserve trailing comment inside classes. **Note:** This change is possibly BC breaking if your
Chris@17 84 code validates that classes can only contain certain statement types. After this change, classes
Chris@17 85 can also contain Nop statements, while this was not previously possible. (#509)
Chris@17 86
Chris@16 87 Version 4.0.2 (2018-06-03)
Chris@16 88 --------------------------
Chris@16 89
Chris@16 90 ### Added
Chris@16 91
Chris@16 92 * Improved error recovery inside classes.
Chris@16 93 * Support error recovery for `foreach` without `as`.
Chris@16 94 * Support error recovery for parameters without variable (`function (Type ) {}`).
Chris@16 95 * Support error recovery for functions without body (`function ($foo)`).
Chris@16 96
Chris@13 97 Version 4.0.1 (2018-03-25)
Chris@13 98 --------------------------
Chris@13 99
Chris@13 100 ### Added
Chris@13 101
Chris@13 102 * [PHP 7.3] Added support for trailing commas in function calls.
Chris@13 103 * [PHP 7.3] Added support for by-reference array destructuring.
Chris@13 104 * Added checks to node traverser to prevent replacing a statement with an expression or vice versa.
Chris@13 105 This should prevent common mistakes in the implementation of node visitors.
Chris@13 106 * Added the following methods to `BuilderFactory`, to simplify creation of expressions:
Chris@13 107 * `funcCall()`
Chris@13 108 * `methodCall()`
Chris@13 109 * `staticCall()`
Chris@13 110 * `new()`
Chris@13 111 * `constFetch()`
Chris@13 112 * `classConstFetch()`
Chris@13 113
Chris@13 114 Version 4.0.0 (2018-02-28)
Chris@13 115 --------------------------
Chris@13 116
Chris@13 117 * No significant code changes since the beta 1 release.
Chris@13 118
Chris@13 119 Version 4.0.0-beta1 (2018-01-27)
Chris@13 120 --------------------------------
Chris@13 121
Chris@13 122 ### Fixed
Chris@13 123
Chris@13 124 * In formatting-preserving pretty printer: Fixed indentation when inserting into lists. (#466)
Chris@13 125
Chris@13 126 ### Added
Chris@13 127
Chris@13 128 * In formatting-preserving pretty printer: Improved formatting of elements inserted into multi-line
Chris@13 129 arrays.
Chris@13 130
Chris@13 131 ### Removed
Chris@13 132
Chris@13 133 * The `Autoloader` class has been removed. It is now required to use the Composer autoloader.
Chris@13 134
Chris@13 135 Version 4.0.0-alpha3 (2017-12-26)
Chris@13 136 ---------------------------------
Chris@13 137
Chris@13 138 ### Fixed
Chris@13 139
Chris@13 140 * In the formatting-preserving pretty printer:
Chris@13 141 * Fixed comment indentation.
Chris@13 142 * Fixed handling of inline HTML in the fallback case.
Chris@13 143 * Fixed insertion into list nodes that require creation of a code block.
Chris@13 144
Chris@13 145 ### Added
Chris@13 146
Chris@13 147 * Added support for inserting at the start of list nodes in formatting-preserving pretty printer.
Chris@13 148
Chris@13 149 Version 4.0.0-alpha2 (2017-11-10)
Chris@13 150 ---------------------------------
Chris@13 151
Chris@13 152 ### Added
Chris@13 153
Chris@13 154 * In the formatting-preserving pretty printer:
Chris@13 155 * Added support for changing modifiers.
Chris@13 156 * Added support for anonymous classes.
Chris@13 157 * Added support for removing from list nodes.
Chris@13 158 * Improved support for changing comments.
Chris@13 159 * Added start token offsets to comments.
Chris@13 160
Chris@13 161 Version 4.0.0-alpha1 (2017-10-18)
Chris@13 162 ---------------------------------
Chris@13 163
Chris@13 164 ### Added
Chris@13 165
Chris@13 166 * Added experimental support for format-preserving pretty-printing. In this mode formatting will be
Chris@13 167 preserved for parts of the code which have not been modified.
Chris@13 168 * Added `replaceNodes` option to `NameResolver`, defaulting to true. If this option is disabled,
Chris@13 169 resolved names will be added as `resolvedName` attributes, instead of replacing the original
Chris@13 170 names.
Chris@13 171 * Added `NodeFinder` class, which can be used to find nodes based on a callback or class name. This
Chris@13 172 is a utility to avoid custom node visitor implementations for simple search operations.
Chris@13 173 * Added `ClassMethod::isMagic()` method.
Chris@13 174 * Added `BuilderFactory` methods: `val()` method for creating an AST for a simple value, `concat()`
Chris@13 175 for creating concatenation trees, `args()` for preparing function arguments.
Chris@13 176 * Added `NameContext` class, which encapsulates the `NameResolver` logic independently of the actual
Chris@13 177 AST traversal. This facilitates use in other context, such as class names in doc comments.
Chris@13 178 Additionally it provides an API for getting the shortest representation of a name.
Chris@13 179 * Added `Node::setAttributes()` method.
Chris@13 180 * Added `JsonDecoder`. This allows conversion JSON back into an AST.
Chris@13 181 * Added `Name` methods `toLowerString()` and `isSpecialClassName()`.
Chris@13 182 * Added `Identifier` and `VarLikeIdentifier` nodes, which are used in place of simple strings in
Chris@13 183 many places.
Chris@13 184 * Added `getComments()`, `getStartLine()`, `getEndLine()`, `getStartTokenPos()`, `getEndTokenPos()`,
Chris@13 185 `getStartFilePos()` and `getEndFilePos()` methods to `Node`. These provide a more obvious access
Chris@13 186 point for the already existing attributes of the same name.
Chris@13 187 * Added `ConstExprEvaluator` to evaluate constant expressions to PHP values.
Chris@13 188 * Added `Expr\BinaryOp::getOperatorSigil()`, returning `+` for `Expr\BinaryOp\Plus`, etc.
Chris@13 189
Chris@13 190 ### Changed
Chris@13 191
Chris@13 192 * Many subnodes that previously held simple strings now use `Identifier` (or `VarLikeIdentifier`)
Chris@13 193 nodes. Please see the UPGRADE-4.0 file for an exhaustive list of affected nodes and some notes on
Chris@13 194 possible impact.
Chris@13 195 * Expression statements (`expr;`) are now represented using a `Stmt\Expression` node. Previously
Chris@13 196 these statements were directly represented as their constituent expression.
Chris@13 197 * The `name` subnode of `Param` has been renamed to `var` and now contains a `Variable` rather than
Chris@13 198 a plain string.
Chris@13 199 * The `name` subnode of `StaticVar` has been renamed to `var` and now contains a `Variable` rather
Chris@13 200 than a plain string.
Chris@13 201 * The `var` subnode of `ClosureUse` now contains a `Variable` rather than a plain string.
Chris@13 202 * The `var` subnode of `Catch` now contains a `Variable` rather than a plain string.
Chris@13 203 * The `alias` subnode of `UseUse` is now `null` if no explicit alias is given. As such,
Chris@13 204 `use Foo\Bar` and `use Foo\Bar as Bar` are now represented differently. The `getAlias()` method
Chris@13 205 can be used to get the effective alias, even if it is not explicitly given.
Chris@13 206
Chris@13 207 ### Removed
Chris@13 208
Chris@13 209 * Support for running on PHP 5 and HHVM has been removed. You can however still parse code of old
Chris@13 210 PHP versions (such as PHP 5.2), while running on PHP 7.
Chris@13 211 * Removed `type` subnode on `Class`, `ClassMethod` and `Property` nodes. Use `flags` instead.
Chris@13 212 * The `ClassConst::isStatic()` method has been removed. Constants cannot have a static modifier.
Chris@13 213 * The `NodeTraverser` no longer accepts `false` as a return value from a `leaveNode()` method.
Chris@13 214 `NodeTraverser::REMOVE_NODE` should be returned instead.
Chris@13 215 * The `Node::setLine()` method has been removed. If you really need to, you can use `setAttribute()`
Chris@13 216 instead.
Chris@13 217 * The misspelled `Class_::VISIBILITY_MODIFER_MASK` constant has been dropped in favor of
Chris@13 218 `Class_::VISIBILITY_MODIFIER_MASK`.
Chris@13 219 * The XML serializer has been removed. As such, the classes `Serializer\XML`, and
Chris@13 220 `Unserializer\XML`, as well as the interfaces `Serializer` and `Unserializer` no longer exist.
Chris@13 221 * The `BuilderAbstract` class has been removed. It's functionality is moved into `BuilderHelpers`.
Chris@13 222 However, this is an internal class and should not be used directly.
Chris@13 223
Chris@13 224 Version 3.1.5 (2018-02-28)
Chris@13 225 --------------------------
Chris@13 226
Chris@13 227 ### Fixed
Chris@13 228
Chris@13 229 * Fixed duplicate comment assignment in switch statements. (#469)
Chris@13 230 * Improve compatibility with PHP-Scoper. (#477)
Chris@13 231
Chris@12 232 Version 3.1.4 (2018-01-25)
Chris@12 233 --------------------------
Chris@12 234
Chris@12 235 ### Fixed
Chris@12 236
Chris@12 237 * Fixed pretty printing of `-(-$x)` and `+(+$x)`. (#459)
Chris@12 238
Chris@12 239 Version 3.1.3 (2017-12-26)
Chris@12 240 --------------------------
Chris@12 241
Chris@12 242 ### Fixed
Chris@12 243
Chris@12 244 * Improve compatibility with php-scoper, by supporting prefixed namespaces in
Chris@12 245 `NodeAbstract::getType()`.
Chris@12 246
Chris@0 247 Version 3.1.2 (2017-11-04)
Chris@0 248 --------------------------
Chris@0 249
Chris@0 250 ### Fixed
Chris@0 251
Chris@0 252 * Comments on empty blocks are now preserved on a `Stmt\Nop` node. (#382)
Chris@0 253
Chris@0 254 ### Added
Chris@0 255
Chris@0 256 * Added `kind` attribute for `Stmt\Namespace_` node, which is one of `KIND_SEMICOLON` or
Chris@0 257 `KIND_BRACED`. (#417)
Chris@0 258 * Added `setDocComment()` method to namespace builder. (#437)
Chris@0 259
Chris@0 260 Version 3.1.1 (2017-09-02)
Chris@0 261 --------------------------
Chris@0 262
Chris@0 263 ### Fixed
Chris@0 264
Chris@0 265 * Fixed syntax error on comment after brace-style namespace declaration. (#412)
Chris@0 266 * Added support for TraitUse statements in trait builder. (#413)
Chris@0 267
Chris@0 268 Version 3.1.0 (2017-07-28)
Chris@0 269 --------------------------
Chris@0 270
Chris@0 271 ### Added
Chris@0 272
Chris@0 273 * [PHP 7.2] Added support for trailing comma in group use statements.
Chris@0 274 * [PHP 7.2] Added support for `object` type. This means `object` types will now be represented as a
Chris@0 275 builtin type (a simple `"object"` string), rather than a class `Name`.
Chris@13 276
Chris@0 277 ### Fixed
Chris@0 278
Chris@0 279 * Floating-point numbers are now printed correctly if the LC_NUMERIC locale uses a comma as decimal
Chris@0 280 separator.
Chris@0 281
Chris@0 282 ### Changed
Chris@0 283
Chris@0 284 * `Name::$parts` is no longer deprecated.
Chris@0 285
Chris@0 286 Version 3.0.6 (2017-06-28)
Chris@0 287 --------------------------
Chris@0 288
Chris@0 289 ### Fixed
Chris@0 290
Chris@0 291 * Fixed the spelling of `Class_::VISIBILITY_MODIFIER_MASK`. The previous spelling of
Chris@0 292 `Class_::VISIBILITY_MODIFER_MASK` is preserved for backwards compatibility.
Chris@0 293 * The pretty printing will now preserve comments inside array literals and function calls by
Chris@0 294 printing the array items / function arguments on separate lines. Array literals and functions that
Chris@0 295 do not contain comments are not affected.
Chris@0 296
Chris@0 297 ### Added
Chris@0 298
Chris@0 299 * Added `Builder\Param::makeVariadic()`.
Chris@0 300
Chris@0 301 ### Deprecated
Chris@0 302
Chris@0 303 * The `Node::setLine()` method has been deprecated.
Chris@0 304
Chris@0 305 Version 3.0.5 (2017-03-05)
Chris@0 306 --------------------------
Chris@0 307
Chris@0 308 ### Fixed
Chris@0 309
Chris@0 310 * Name resolution of `NullableType`s is now performed earlier, so that a fully resolved signature is
Chris@0 311 available when a function is entered. (#360)
Chris@0 312 * `Error` nodes are now considered empty, while previously they extended until the token where the
Chris@0 313 error occurred. This made some nodes larger than expected. (#359)
Chris@0 314 * Fixed notices being thrown during error recovery in some situations. (#362)
Chris@0 315
Chris@0 316 Version 3.0.4 (2017-02-10)
Chris@0 317 --------------------------
Chris@0 318
Chris@0 319 ### Fixed
Chris@0 320
Chris@0 321 * Fixed some extensibility issues in pretty printer (`pUseType()` is now public and `pPrec()` calls
Chris@0 322 into `p()`, instead of directly dispatching to the type-specific printing method).
Chris@0 323 * Fixed notice in `bin/php-parse` script.
Chris@0 324
Chris@0 325 ### Added
Chris@0 326
Chris@0 327 * Error recovery from missing semicolons is now supported in more cases.
Chris@0 328 * Error recovery from trailing commas in positions where PHP does not support them is now supported.
Chris@0 329
Chris@0 330 Version 3.0.3 (2017-02-03)
Chris@0 331 --------------------------
Chris@0 332
Chris@0 333 ### Fixed
Chris@0 334
Chris@0 335 * In `"$foo[0]"` the `0` is now parsed as an `LNumber` rather than `String`. (#325)
Chris@0 336 * Ensure integers and floats are always pretty printed preserving semantics, even if the particular
Chris@0 337 value can only be manually constructed.
Chris@0 338 * Throw a `LogicException` when trying to pretty-print an `Error` node. Previously this resulted in
Chris@0 339 an undefined method exception or fatal error.
Chris@0 340
Chris@0 341 ### Added
Chris@0 342
Chris@0 343 * [PHP 7.1] Added support for negative interpolated offsets: `"$foo[-1]"`
Chris@0 344 * Added `preserveOriginalNames` option to `NameResolver`. If this option is enabled, an
Chris@0 345 `originalName` attribute, containing the unresolved name, will be added to each resolved name.
Chris@0 346 * Added `php-parse --with-positions` option, which dumps nodes with position information.
Chris@0 347
Chris@0 348 ### Deprecated
Chris@0 349
Chris@0 350 * The XML serializer has been deprecated. In particular, the classes `Serializer\XML`,
Chris@0 351 `Unserializer\XML`, as well as the interfaces `Serializer` and `Unserializer` are deprecated.
Chris@0 352
Chris@0 353 Version 3.0.2 (2016-12-06)
Chris@0 354 --------------------------
Chris@0 355
Chris@0 356 ### Fixed
Chris@0 357
Chris@0 358 * Fixed name resolution of nullable types. (#324)
Chris@0 359 * Fixed pretty-printing of nullable types.
Chris@0 360
Chris@0 361 Version 3.0.1 (2016-12-01)
Chris@0 362 --------------------------
Chris@0 363
Chris@0 364 ### Fixed
Chris@0 365
Chris@0 366 * Fixed handling of nested `list()`s: If the nested list was unkeyed, it was directly included in
Chris@0 367 the list items. If it was keyed, it was wrapped in `ArrayItem`. Now nested `List_` nodes are
Chris@0 368 always wrapped in `ArrayItem`s. (#321)
Chris@0 369
Chris@0 370 Version 3.0.0 (2016-11-30)
Chris@0 371 --------------------------
Chris@0 372
Chris@0 373 ### Added
Chris@0 374
Chris@0 375 * Added support for dumping node positions in the NodeDumper through the `dumpPositions` option.
Chris@0 376 * Added error recovery support for `$`, `new`, `Foo::`.
Chris@0 377
Chris@0 378 Version 3.0.0-beta2 (2016-10-29)
Chris@0 379 --------------------------------
Chris@0 380
Chris@0 381 This release primarily improves our support for error recovery.
Chris@0 382
Chris@0 383 ### Added
Chris@0 384
Chris@0 385 * Added `Node::setDocComment()` method.
Chris@0 386 * Added `Error::getMessageWithColumnInfo()` method.
Chris@0 387 * Added support for recovery from lexer errors.
Chris@0 388 * Added support for recovering from "special" errors (i.e. non-syntax parse errors).
Chris@0 389 * Added precise location information for lexer errors.
Chris@0 390 * Added `ErrorHandler` interface, and `ErrorHandler\Throwing` and `ErrorHandler\Collecting` as
Chris@0 391 specific implementations. These provide a general mechanism for handling error recovery.
Chris@0 392 * Added optional `ErrorHandler` argument to `Parser::parse()`, `Lexer::startLexing()` and
Chris@0 393 `NameResolver::__construct()`.
Chris@0 394 * The `NameResolver` now adds a `namespacedName` attribute on name nodes that cannot be statically
Chris@0 395 resolved (unqualified unaliased function or constant names in namespaces).
Chris@13 396
Chris@0 397 ### Fixed
Chris@0 398
Chris@0 399 * Fixed attribute assignment for `GroupUse` prefix and variables in interpolated strings.
Chris@0 400
Chris@0 401 ### Changed
Chris@0 402
Chris@0 403 * The constants on `NameTraverserInterface` have been moved into the `NameTraverser` class.
Chris@0 404 * Due to the error handling changes, the `Parser` interface and `Lexer` API have changed.
Chris@0 405 * The emulative lexer now directly postprocesses tokens, instead of using `~__EMU__~` sequences.
Chris@0 406 This changes the protected API of the lexer.
Chris@0 407 * The `Name::slice()` method now returns `null` for empty slices, previously `new Name([])` was
Chris@0 408 used. `Name::concat()` now also supports concatenation with `null`.
Chris@0 409
Chris@0 410 ### Removed
Chris@0 411
Chris@0 412 * Removed `Name::append()` and `Name::prepend()`. These mutable methods have been superseded by
Chris@0 413 the immutable `Name::concat()`.
Chris@0 414 * Removed `Error::getRawLine()` and `Error::setRawLine()`. These methods have been superseded by
Chris@0 415 `Error::getStartLine()` and `Error::setStartLine()`.
Chris@0 416 * Removed support for node cloning in the `NodeTraverser`.
Chris@0 417 * Removed `$separator` argument from `Name::toString()`.
Chris@0 418 * Removed `throw_on_error` parser option and `Parser::getErrors()` method. Use the `ErrorHandler`
Chris@0 419 mechanism instead.
Chris@0 420
Chris@0 421 Version 3.0.0-beta1 (2016-09-16)
Chris@0 422 --------------------------------
Chris@0 423
Chris@0 424 ### Added
Chris@0 425
Chris@0 426 * [7.1] Function/method and parameter builders now support PHP 7.1 type hints (void, iterable and
Chris@0 427 nullable types).
Chris@0 428 * Nodes and Comments now implement `JsonSerializable`. The node kind is stored in a `nodeType`
Chris@0 429 property.
Chris@0 430 * The `InlineHTML` node now has an `hasLeadingNewline` attribute, that specifies whether the
Chris@0 431 preceding closing tag contained a newline. The pretty printer honors this attribute.
Chris@0 432 * Partial parsing of `$obj->` (with missing property name) is now supported in error recovery mode.
Chris@0 433 * The error recovery mode is now exposed in the `php-parse` script through the `--with-recovery`
Chris@0 434 or `-r` flags.
Chris@0 435
Chris@0 436 The following changes are also part of PHP-Parser 2.1.1:
Chris@0 437
Chris@0 438 * The PHP 7 parser will now generate a parse error for `$var =& new Obj` assignments.
Chris@0 439 * Comments on free-standing code blocks will now be retained as comments on the first statement in
Chris@0 440 the code block.
Chris@0 441
Chris@0 442 Version 3.0.0-alpha1 (2016-07-25)
Chris@0 443 ---------------------------------
Chris@0 444
Chris@0 445 ### Added
Chris@0 446
Chris@0 447 * [7.1] Added support for `void` and `iterable` types. These will now be represented as strings
Chris@0 448 (instead of `Name` instances) similar to other builtin types.
Chris@0 449 * [7.1] Added support for class constant visibility. The `ClassConst` node now has a `flags` subnode
Chris@0 450 holding the visibility modifier, as well as `isPublic()`, `isProtected()` and `isPrivate()`
Chris@0 451 methods. The constructor changed to accept the additional subnode.
Chris@0 452 * [7.1] Added support for nullable types. These are represented using a new `NullableType` node
Chris@0 453 with a single `type` subnode.
Chris@0 454 * [7.1] Added support for short array destructuring syntax. This means that `Array` nodes may now
Chris@0 455 appear as the left-hand-side of assignments and foreach value targets. Additionally the array
Chris@0 456 items may now contain `null` values if elements are skipped.
Chris@0 457 * [7.1] Added support for keys in list() destructuring. The `List` subnode `vars` has been renamed
Chris@0 458 to `items` and now contains `ArrayItem`s instead of plain variables.
Chris@0 459 * [7.1] Added support for multi-catch. The `Catch` subnode `type` has been renamed to `types` and
Chris@0 460 is now an array of `Name`s.
Chris@0 461 * `Name::slice()` now supports lengths and negative offsets. This brings it in line with
Chris@0 462 `array_slice()` functionality.
Chris@0 463
Chris@0 464 ### Changed
Chris@0 465
Chris@0 466 Due to PHP 7.1 support additions described above, the node structure changed as follows:
Chris@0 467
Chris@0 468 * `void` and `iterable` types are now stored as strings if the PHP 7 parser is used.
Chris@0 469 * The `ClassConst` constructor changed to accept an additional `flags` subnode.
Chris@0 470 * The `Array` subnode `items` may now contain `null` elements (destructuring).
Chris@0 471 * The `List` subnode `vars` has been renamed to `items` and now contains `ArrayItem`s instead of
Chris@0 472 plain variables.
Chris@0 473 * The `Catch` subnode `type` has been renamed to `types` and is now an array of `Name`s.
Chris@0 474
Chris@0 475 Additionally the following changes were made:
Chris@0 476
Chris@0 477 * The `type` subnode on `Class`, `ClassMethod` and `Property` has been renamed to `flags`. The
Chris@0 478 `type` subnode has retained for backwards compatibility and is populated to the same value as
Chris@0 479 `flags`. However, writes to `type` will not update `flags`.
Chris@0 480 * The `TryCatch` subnode `finallyStmts` has been replaced with a `finally` subnode that holds an
Chris@0 481 explicit `Finally` node. This allows for more accurate attribute assignment.
Chris@0 482 * The `Trait` constructor now has the same form as the `Class` and `Interface` constructors: It
Chris@0 483 takes an array of subnodes. Unlike classes/interfaces, traits can only have a `stmts` subnode.
Chris@0 484 * The `NodeDumper` now prints class/method/property/constant modifiers, as well as the include and
Chris@0 485 use type in a textual representation, instead of only showing the number.
Chris@13 486 * All methods on `PrettyPrinter\Standard` are now protected. Previously most of them were public.
Chris@0 487
Chris@0 488 ### Removed
Chris@0 489
Chris@0 490 * Removed support for running on PHP 5.4. It is however still possible to parse PHP 5.2-5.4 code
Chris@0 491 while running on a newer version.
Chris@0 492 * The deprecated `Comment::setLine()` and `Comment::setText()` methods have been removed.
Chris@0 493 * The deprecated `Name::set()`, `Name::setFirst()` and `Name::setLast()` methods have been removed.
Chris@0 494
Chris@0 495 Version 2.1.1 (2016-09-16)
Chris@0 496 --------------------------
Chris@0 497
Chris@0 498 ### Changed
Chris@0 499
Chris@0 500 * The pretty printer will now escape all control characters in the range `\x00-\x1F` inside double
Chris@0 501 quoted strings. If no special escape sequence is available, an octal escape will be used.
Chris@0 502 * The quality of the error recovery has been improved. In particular unterminated expressions should
Chris@0 503 be handled more gracefully.
Chris@0 504 * The PHP 7 parser will now generate a parse error for `$var =& new Obj` assignments.
Chris@0 505 * Comments on free-standing code blocks will no be retained as comments on the first statement in
Chris@0 506 the code block.
Chris@0 507
Chris@0 508 Version 2.1.0 (2016-04-19)
Chris@0 509 --------------------------
Chris@0 510
Chris@0 511 ### Fixed
Chris@0 512
Chris@0 513 * Properly support `B""` strings (with uppercase `B`) in a number of places.
Chris@0 514 * Fixed reformatting of indented parts in a certain non-standard comment style.
Chris@0 515
Chris@0 516 ### Added
Chris@0 517
Chris@0 518 * Added `dumpComments` option to node dumper, to enable dumping of comments associated with nodes.
Chris@0 519 * Added `Stmt\Nop` node, that is used to collect comments located at the end of a block or at the
Chris@0 520 end of a file (without a following node with which they could otherwise be associated).
Chris@0 521 * Added `kind` attribute to `Expr\Exit` to distinguish between `exit` and `die`.
Chris@0 522 * Added `kind` attribute to `Scalar\LNumber` to distinguish between decimal, binary, octal and
Chris@0 523 hexadecimal numbers.
Chris@13 524 * Added `kind` attribute to `Expr\Array` to distinguish between `array()` and `[]`.
Chris@0 525 * Added `kind` attribute to `Scalar\String` and `Scalar\Encapsed` to distinguish between
Chris@0 526 single-quoted, double-quoted, heredoc and nowdoc string.
Chris@0 527 * Added `docLabel` attribute to `Scalar\String` and `Scalar\Encapsed`, if it is a heredoc or
Chris@0 528 nowdoc string.
Chris@0 529 * Added start file offset information to `Comment` nodes.
Chris@0 530 * Added `setReturnType()` method to function and method builders.
Chris@0 531 * Added `-h` and `--help` options to `php-parse` script.
Chris@0 532
Chris@0 533 ### Changed
Chris@0 534
Chris@0 535 * Invalid octal literals now throw a parse error in PHP 7 mode.
Chris@0 536 * The pretty printer takes all the new attributes mentioned in the previous section into account.
Chris@0 537 * The protected `AbstractPrettyPrinter::pComments()` method no longer returns a trailing newline.
Chris@0 538 * The bundled autoloader supports library files being stored in a different directory than
Chris@0 539 `PhpParser` for easier downstream distribution.
Chris@0 540
Chris@0 541 ### Deprecated
Chris@0 542
Chris@0 543 * The `Comment::setLine()` and `Comment::setText()` methods have been deprecated. Construct new
Chris@0 544 objects instead.
Chris@0 545
Chris@0 546 ### Removed
Chris@0 547
Chris@0 548 * The internal (but public) method `Scalar\LNumber::parse()` has been removed. A non-internal
Chris@0 549 `LNumber::fromString()` method has been added instead.
Chris@0 550
Chris@0 551 Version 2.0.1 (2016-02-28)
Chris@0 552 --------------------------
Chris@0 553
Chris@0 554 ### Fixed
Chris@0 555
Chris@0 556 * `declare() {}` and `declare();` are not semantically equivalent and will now result in different
Chris@0 557 ASTs. The format case will have an empty `stmts` array, while the latter will set `stmts` to
Chris@0 558 `null`.
Chris@0 559 * Magic constants are now supported as semi-reserved keywords.
Chris@0 560 * A shebang line like `#!/usr/bin/env php` is now allowed at the start of a namespaced file.
Chris@0 561 Previously this generated an exception.
Chris@0 562 * The `prettyPrintFile()` method will not strip a trailing `?>` from the raw data that follows a
Chris@0 563 `__halt_compiler()` statement.
Chris@0 564 * The `prettyPrintFile()` method will not strip an opening `<?php` if the file starts with a
Chris@0 565 comment followed by InlineHTML.
Chris@0 566
Chris@0 567 Version 2.0.0 (2015-12-04)
Chris@0 568 --------------------------
Chris@0 569
Chris@0 570 ### Changed
Chris@0 571
Chris@0 572 * String parts of encapsed strings are now represented using `Scalar\EncapsStringPart` nodes.
Chris@0 573 Previously raw strings were used. This affects the `parts` child of `Scalar\Encaps` and
Chris@0 574 `Expr\ShellExec`. The change has been done to allow assignment of attributes to encapsed string
Chris@0 575 parts.
Chris@0 576
Chris@0 577 Version 2.0.0-beta1 (2015-10-21)
Chris@0 578 --------------------------------
Chris@0 579
Chris@0 580 ### Fixed
Chris@0 581
Chris@0 582 * Fixed issue with too many newlines being stripped at the end of heredoc/nowdoc strings in some
Chris@0 583 cases. (#227)
Chris@0 584
Chris@0 585 ### Changed
Chris@0 586
Chris@0 587 * Update group use support to be in line with recent PHP 7.0 builds.
Chris@0 588 * Renamed `php-parse.php` to `php-parse` and registered it as a composer bin.
Chris@0 589 * Use composer PSR-4 autoloader instead of custom autoloader.
Chris@0 590 * Specify phpunit as a dev dependency.
Chris@0 591
Chris@0 592 ### Added
Chris@0 593
Chris@0 594 * Added `shortArraySyntax` option to pretty printer, to print all arrays using short syntax.
Chris@0 595
Chris@0 596 Version 2.0.0-alpha1 (2015-07-14)
Chris@0 597 ---------------------------------
Chris@0 598
Chris@0 599 A more detailed description of backwards incompatible changes can be found in the
Chris@0 600 [upgrading guide](UPGRADE-2.0.md).
Chris@0 601
Chris@0 602 ### Removed
Chris@0 603
Chris@0 604 * Removed support for running on PHP 5.3. It is however still possible to parse PHP 5.2 and PHP 5.3
Chris@0 605 code while running on a newer version.
Chris@0 606 * Removed legacy class name aliases. This includes the old non-namespaced class names and the old
Chris@0 607 names for classes that were renamed for PHP 7 compatibility.
Chris@0 608 * Removed support for legacy node format. All nodes must have a `getSubNodeNames()` method now.
Chris@0 609
Chris@0 610 ### Added
Chris@0 611
Chris@0 612 * Added support for remaining PHP 7 features that were not present in 1.x:
Chris@0 613 * Group use declarations. These are represented using `Stmt\GroupUse` nodes. Furthermore a `type`
Chris@0 614 attribute was added to `Stmt\UseUse` to handle mixed group use declarations.
Chris@0 615 * Uniform variable syntax.
Chris@0 616 * Generalized yield operator.
Chris@0 617 * Scalar type declarations. These are presented using `'bool'`, `'int'`, `'float'` and `'string'`
Chris@0 618 as the type. The PHP 5 parser also accepts these, however they'll be `Name` instances there.
Chris@0 619 * Unicode escape sequences.
Chris@0 620 * Added `PhpParser\ParserFactory` class, which should be used to create parser instances.
Chris@0 621 * Added `Name::concat()` which concatenates two names.
Chris@0 622 * Added `Name->slice()` which takes a subslice of a name.
Chris@0 623
Chris@0 624 ### Changed
Chris@0 625
Chris@0 626 * `PhpParser\Parser` is now an interface, implemented by `Parser\Php5`, `Parser\Php7` and
Chris@0 627 `Parser\Multiple`. The `Multiple` parser will try multiple parsers, until one succeeds.
Chris@0 628 * Token constants are now defined on `PhpParser\Parser\Tokens` rather than `PhpParser\Parser`.
Chris@0 629 * The `Name->set()`, `Name->append()`, `Name->prepend()` and `Name->setFirst()` methods are
Chris@0 630 deprecated in favor of `Name::concat()` and `Name->slice()`.
Chris@0 631 * The `NodeTraverser` no longer clones nodes by default. The old behavior can be restored by
Chris@0 632 passing `true` to the constructor.
Chris@0 633 * The constructor for `Scalar` nodes no longer has a default value. E.g. `new LNumber()` should now
Chris@0 634 be written as `new LNumber(0)`.
Chris@0 635
Chris@0 636 ---
Chris@0 637
Chris@0 638 **This changelog only includes changes from the 2.0 series. For older changes see the
Chris@0 639 [1.x series changelog](https://github.com/nikic/PHP-Parser/blob/1.x/CHANGELOG.md) and the
Chris@13 640 [0.9 series changelog](https://github.com/nikic/PHP-Parser/blob/0.9/CHANGELOG.md).**