Security update for Core, with self-updated composer
[yaffs-website] / vendor / nikic / php-parser / CHANGELOG.md
1 Version 3.1.6-dev
2 -----------------
3
4 Nothing yet.
5
6 Version 3.1.5 (2018-02-28)
7 --------------------------
8
9 ### Fixed
10
11 * Fixed duplicate comment assignment in switch statements. (#469)
12 * Improve compatibility with PHP-Scoper. (#477)
13
14 Version 3.1.4 (2018-01-25)
15 --------------------------
16
17 ### Fixed
18
19 * Fixed pretty printing of `-(-$x)` and `+(+$x)`. (#459)
20
21 Version 3.1.3 (2017-12-26)
22 --------------------------
23
24 ### Fixed
25
26 * Improve compatibility with php-scoper, by supporting prefixed namespaces in
27   `NodeAbstract::getType()`.
28
29 Version 3.1.2 (2017-11-04)
30 --------------------------
31
32 ### Fixed
33
34 * Comments on empty blocks are now preserved on a `Stmt\Nop` node. (#382)
35
36 ### Added
37
38 * Added `kind` attribute for `Stmt\Namespace_` node, which is one of `KIND_SEMICOLON` or
39   `KIND_BRACED`. (#417)
40 * Added `setDocComment()` method to namespace builder. (#437)
41
42 Version 3.1.1 (2017-09-02)
43 --------------------------
44
45 ### Fixed
46
47 * Fixed syntax error on comment after brace-style namespace declaration. (#412)
48 * Added support for TraitUse statements in trait builder. (#413)
49
50 Version 3.1.0 (2017-07-28)
51 --------------------------
52
53 ### Added
54
55 * [PHP 7.2] Added support for trailing comma in group use statements.
56 * [PHP 7.2] Added support for `object` type. This means `object` types will now be represented as a
57   builtin type (a simple `"object"` string), rather than a class `Name`.
58   
59 ### Fixed
60
61 * Floating-point numbers are now printed correctly if the LC_NUMERIC locale uses a comma as decimal
62   separator.
63
64 ### Changed
65
66 * `Name::$parts` is no longer deprecated.
67
68 Version 3.0.6 (2017-06-28)
69 --------------------------
70
71 ### Fixed
72
73 * Fixed the spelling of `Class_::VISIBILITY_MODIFIER_MASK`. The previous spelling of
74   `Class_::VISIBILITY_MODIFER_MASK` is preserved for backwards compatibility.
75 * The pretty printing will now preserve comments inside array literals and function calls by
76   printing the array items / function arguments on separate lines. Array literals and functions that
77   do not contain comments are not affected.
78
79 ### Added
80
81 * Added `Builder\Param::makeVariadic()`.
82
83 ### Deprecated
84
85 * The `Node::setLine()` method has been deprecated.
86
87 Version 3.0.5 (2017-03-05)
88 --------------------------
89
90 ### Fixed
91
92 * Name resolution of `NullableType`s is now performed earlier, so that a fully resolved signature is
93   available when a function is entered. (#360)
94 * `Error` nodes are now considered empty, while previously they extended until the token where the
95   error occurred. This made some nodes larger than expected. (#359)
96 * Fixed notices being thrown during error recovery in some situations. (#362)
97
98 Version 3.0.4 (2017-02-10)
99 --------------------------
100
101 ### Fixed
102
103 * Fixed some extensibility issues in pretty printer (`pUseType()` is now public and `pPrec()` calls
104   into `p()`, instead of directly dispatching to the type-specific printing method).
105 * Fixed notice in `bin/php-parse` script.
106
107 ### Added
108
109 * Error recovery from missing semicolons is now supported in more cases.
110 * Error recovery from trailing commas in positions where PHP does not support them is now supported.
111
112 Version 3.0.3 (2017-02-03)
113 --------------------------
114
115 ### Fixed
116
117 * In `"$foo[0]"` the `0` is now parsed as an `LNumber` rather than `String`. (#325)
118 * Ensure integers and floats are always pretty printed preserving semantics, even if the particular
119   value can only be manually constructed.
120 * Throw a `LogicException` when trying to pretty-print an `Error` node. Previously this resulted in
121   an undefined method exception or fatal error.
122
123 ### Added
124
125 * [PHP 7.1] Added support for negative interpolated offsets: `"$foo[-1]"`
126 * Added `preserveOriginalNames` option to `NameResolver`. If this option is enabled, an
127   `originalName` attribute, containing the unresolved name, will be added to each resolved name.
128 * Added `php-parse --with-positions` option, which dumps nodes with position information.
129
130 ### Deprecated
131
132 * The XML serializer has been deprecated. In particular, the classes `Serializer\XML`,
133   `Unserializer\XML`, as well as the interfaces `Serializer` and `Unserializer` are deprecated.
134
135 Version 3.0.2 (2016-12-06)
136 --------------------------
137
138 ### Fixed
139
140 * Fixed name resolution of nullable types. (#324)
141 * Fixed pretty-printing of nullable types.
142
143 Version 3.0.1 (2016-12-01)
144 --------------------------
145
146 ### Fixed
147
148 * Fixed handling of nested `list()`s: If the nested list was unkeyed, it was directly included in
149   the list items. If it was keyed, it was wrapped in `ArrayItem`. Now nested `List_` nodes are
150   always wrapped in `ArrayItem`s. (#321)
151
152 Version 3.0.0 (2016-11-30)
153 --------------------------
154
155 ### Added
156
157 * Added support for dumping node positions in the NodeDumper through the `dumpPositions` option.
158 * Added error recovery support for `$`, `new`, `Foo::`.
159
160 Version 3.0.0-beta2 (2016-10-29)
161 --------------------------------
162
163 This release primarily improves our support for error recovery.
164
165 ### Added
166
167 * Added `Node::setDocComment()` method.
168 * Added `Error::getMessageWithColumnInfo()` method.
169 * Added support for recovery from lexer errors.
170 * Added support for recovering from "special" errors (i.e. non-syntax parse errors).
171 * Added precise location information for lexer errors.
172 * Added `ErrorHandler` interface, and `ErrorHandler\Throwing` and `ErrorHandler\Collecting` as
173   specific implementations. These provide a general mechanism for handling error recovery.
174 * Added optional `ErrorHandler` argument to `Parser::parse()`, `Lexer::startLexing()` and
175   `NameResolver::__construct()`.
176 * The `NameResolver` now adds a `namespacedName` attribute on name nodes that cannot be statically
177   resolved (unqualified unaliased function or constant names in namespaces).
178   
179 ### Fixed
180
181 * Fixed attribute assignment for `GroupUse` prefix and variables in interpolated strings.
182
183 ### Changed
184
185 * The constants on `NameTraverserInterface` have been moved into the `NameTraverser` class.
186 * Due to the error handling changes, the `Parser` interface and `Lexer` API have changed.
187 * The emulative lexer now directly postprocesses tokens, instead of using `~__EMU__~` sequences.
188   This changes the protected API of the lexer.
189 * The `Name::slice()` method now returns `null` for empty slices, previously `new Name([])` was
190   used. `Name::concat()` now also supports concatenation with `null`.
191
192 ### Removed
193
194 * Removed `Name::append()` and `Name::prepend()`. These mutable methods have been superseded by
195   the immutable `Name::concat()`.
196 * Removed `Error::getRawLine()` and `Error::setRawLine()`. These methods have been superseded by
197   `Error::getStartLine()` and `Error::setStartLine()`.
198 * Removed support for node cloning in the `NodeTraverser`.
199 * Removed `$separator` argument from `Name::toString()`.
200 * Removed `throw_on_error` parser option and `Parser::getErrors()` method. Use the `ErrorHandler`
201   mechanism instead.
202
203 Version 3.0.0-beta1 (2016-09-16)
204 --------------------------------
205
206 ### Added
207
208 * [7.1] Function/method and parameter builders now support PHP 7.1 type hints (void, iterable and
209   nullable types).
210 * Nodes and Comments now implement `JsonSerializable`. The node kind is stored in a `nodeType`
211   property.
212 * The `InlineHTML` node now has an `hasLeadingNewline` attribute, that specifies whether the
213   preceding closing tag contained a newline. The pretty printer honors this attribute.
214 * Partial parsing of `$obj->` (with missing property name) is now supported in error recovery mode.
215 * The error recovery mode is now exposed in the `php-parse` script through the `--with-recovery`
216   or `-r` flags.
217
218 The following changes are also part of PHP-Parser 2.1.1:
219
220 * The PHP 7 parser will now generate a parse error for `$var =& new Obj` assignments.
221 * Comments on free-standing code blocks will now be retained as comments on the first statement in
222   the code block.
223
224 Version 3.0.0-alpha1 (2016-07-25)
225 ---------------------------------
226
227 ### Added
228
229 * [7.1] Added support for `void` and `iterable` types. These will now be represented as strings
230   (instead of `Name` instances) similar to other builtin types.
231 * [7.1] Added support for class constant visibility. The `ClassConst` node now has a `flags` subnode
232   holding the visibility modifier, as well as `isPublic()`, `isProtected()` and `isPrivate()`
233   methods. The constructor changed to accept the additional subnode.
234 * [7.1] Added support for nullable types. These are represented using a new `NullableType` node
235   with a single `type` subnode.
236 * [7.1] Added support for short array destructuring syntax. This means that `Array` nodes may now
237   appear as the left-hand-side of assignments and foreach value targets. Additionally the array
238   items may now contain `null` values if elements are skipped.
239 * [7.1] Added support for keys in list() destructuring. The `List` subnode `vars` has been renamed
240   to `items` and now contains `ArrayItem`s instead of plain variables.
241 * [7.1] Added support for multi-catch. The `Catch` subnode `type` has been renamed to `types` and
242   is now an array of `Name`s.
243 * `Name::slice()` now supports lengths and negative offsets. This brings it in line with
244   `array_slice()` functionality.
245
246 ### Changed
247
248 Due to PHP 7.1 support additions described above, the node structure changed as follows:
249
250 * `void` and `iterable` types are now stored as strings if the PHP 7 parser is used.
251 * The `ClassConst` constructor changed to accept an additional `flags` subnode.
252 * The `Array` subnode `items` may now contain `null` elements (destructuring).
253 * The `List` subnode `vars` has been renamed to `items` and now contains `ArrayItem`s instead of
254   plain variables.
255 * The `Catch` subnode `type` has been renamed to `types` and is now an array of `Name`s.
256
257 Additionally the following changes were made:
258
259 * The `type` subnode on `Class`, `ClassMethod` and `Property` has been renamed to `flags`. The
260   `type` subnode has retained for backwards compatibility and is populated to the same value as
261   `flags`. However, writes to `type` will not update `flags`.
262 * The `TryCatch` subnode `finallyStmts` has been replaced with a `finally` subnode that holds an
263   explicit `Finally` node. This allows for more accurate attribute assignment.
264 * The `Trait` constructor now has the same form as the `Class` and `Interface` constructors: It
265   takes an array of subnodes. Unlike classes/interfaces, traits can only have a `stmts` subnode.
266 * The `NodeDumper` now prints class/method/property/constant modifiers, as well as the include and
267   use type in a textual representation, instead of only showing the number.
268 * All methods on `PrettyPrinter\Standard` are now protected. Previoulsy most of them were public.
269
270 ### Removed
271
272 * Removed support for running on PHP 5.4. It is however still possible to parse PHP 5.2-5.4 code
273   while running on a newer version.
274 * The deprecated `Comment::setLine()` and `Comment::setText()` methods have been removed.
275 * The deprecated `Name::set()`, `Name::setFirst()` and `Name::setLast()` methods have been removed.
276
277 Version 2.1.1 (2016-09-16)
278 --------------------------
279
280 ### Changed
281
282 * The pretty printer will now escape all control characters in the range `\x00-\x1F` inside double
283   quoted strings. If no special escape sequence is available, an octal escape will be used.
284 * The quality of the error recovery has been improved. In particular unterminated expressions should
285   be handled more gracefully.
286 * The PHP 7 parser will now generate a parse error for `$var =& new Obj` assignments.
287 * Comments on free-standing code blocks will no be retained as comments on the first statement in
288   the code block.
289
290 Version 2.1.0 (2016-04-19)
291 --------------------------
292
293 ### Fixed
294
295 * Properly support `B""` strings (with uppercase `B`) in a number of places.
296 * Fixed reformatting of indented parts in a certain non-standard comment style.
297
298 ### Added
299
300 * Added `dumpComments` option to node dumper, to enable dumping of comments associated with nodes.
301 * Added `Stmt\Nop` node, that is used to collect comments located at the end of a block or at the
302   end of a file (without a following node with which they could otherwise be associated).
303 * Added `kind` attribute to `Expr\Exit` to distinguish between `exit` and `die`.
304 * Added `kind` attribute to `Scalar\LNumber` to distinguish between decimal, binary, octal and
305   hexadecimal numbers.
306 * Added `kind` attribtue to `Expr\Array` to distinguish between `array()` and `[]`.
307 * Added `kind` attribute to `Scalar\String` and `Scalar\Encapsed` to distinguish between
308   single-quoted, double-quoted, heredoc and nowdoc string.
309 * Added `docLabel` attribute to `Scalar\String` and `Scalar\Encapsed`, if it is a heredoc or
310   nowdoc string.
311 * Added start file offset information to `Comment` nodes.
312 * Added `setReturnType()` method to function and method builders.
313 * Added `-h` and `--help` options to `php-parse` script.
314
315 ### Changed
316
317 * Invalid octal literals now throw a parse error in PHP 7 mode.
318 * The pretty printer takes all the new attributes mentioned in the previous section into account.
319 * The protected `AbstractPrettyPrinter::pComments()` method no longer returns a trailing newline.
320 * The bundled autoloader supports library files being stored in a different directory than
321   `PhpParser` for easier downstream distribution.
322
323 ### Deprecated
324
325 * The `Comment::setLine()` and `Comment::setText()` methods have been deprecated. Construct new
326   objects instead.
327
328 ### Removed
329
330 * The internal (but public) method `Scalar\LNumber::parse()` has been removed. A non-internal
331   `LNumber::fromString()` method has been added instead.
332
333 Version 2.0.1 (2016-02-28)
334 --------------------------
335
336 ### Fixed
337
338 * `declare() {}` and `declare();` are not semantically equivalent and will now result in different
339   ASTs. The format case will have an empty `stmts` array, while the latter will set `stmts` to
340   `null`.
341 * Magic constants are now supported as semi-reserved keywords.
342 * A shebang line like `#!/usr/bin/env php` is now allowed at the start of a namespaced file.
343   Previously this generated an exception.
344 * The `prettyPrintFile()` method will not strip a trailing `?>` from the raw data that follows a
345   `__halt_compiler()` statement.
346 * The `prettyPrintFile()` method will not strip an opening `<?php` if the file starts with a
347   comment followed by InlineHTML.
348
349 Version 2.0.0 (2015-12-04)
350 --------------------------
351
352 ### Changed
353
354 * String parts of encapsed strings are now represented using `Scalar\EncapsStringPart` nodes.
355   Previously raw strings were used. This affects the `parts` child of `Scalar\Encaps` and
356   `Expr\ShellExec`. The change has been done to allow assignment of attributes to encapsed string
357   parts.
358
359 Version 2.0.0-beta1 (2015-10-21)
360 --------------------------------
361
362 ### Fixed
363
364 * Fixed issue with too many newlines being stripped at the end of heredoc/nowdoc strings in some
365   cases. (#227)
366
367 ### Changed
368
369 * Update group use support to be in line with recent PHP 7.0 builds.
370 * Renamed `php-parse.php` to `php-parse` and registered it as a composer bin.
371 * Use composer PSR-4 autoloader instead of custom autoloader.
372 * Specify phpunit as a dev dependency.
373
374 ### Added
375
376 * Added `shortArraySyntax` option to pretty printer, to print all arrays using short syntax.
377
378 Version 2.0.0-alpha1 (2015-07-14)
379 ---------------------------------
380
381 A more detailed description of backwards incompatible changes can be found in the
382 [upgrading guide](UPGRADE-2.0.md).
383
384 ### Removed
385
386 * Removed support for running on PHP 5.3. It is however still possible to parse PHP 5.2 and PHP 5.3
387   code while running on a newer version.
388 * Removed legacy class name aliases. This includes the old non-namespaced class names and the old
389   names for classes that were renamed for PHP 7 compatibility.
390 * Removed support for legacy node format. All nodes must have a `getSubNodeNames()` method now.
391
392 ### Added
393
394 * Added support for remaining PHP 7 features that were not present in 1.x:
395   * Group use declarations. These are represented using `Stmt\GroupUse` nodes. Furthermore a `type`
396     attribute was added to `Stmt\UseUse` to handle mixed group use declarations.
397   * Uniform variable syntax.
398   * Generalized yield operator.
399   * Scalar type declarations. These are presented using `'bool'`, `'int'`, `'float'` and `'string'`
400     as the type. The PHP 5 parser also accepts these, however they'll be `Name` instances there.
401   * Unicode escape sequences.
402 * Added `PhpParser\ParserFactory` class, which should be used to create parser instances.
403 * Added `Name::concat()` which concatenates two names.
404 * Added `Name->slice()` which takes a subslice of a name.
405
406 ### Changed
407
408 * `PhpParser\Parser` is now an interface, implemented by `Parser\Php5`, `Parser\Php7` and
409   `Parser\Multiple`. The `Multiple` parser will try multiple parsers, until one succeeds.
410 * Token constants are now defined on `PhpParser\Parser\Tokens` rather than `PhpParser\Parser`.
411 * The `Name->set()`, `Name->append()`, `Name->prepend()` and `Name->setFirst()` methods are
412   deprecated in favor of `Name::concat()` and `Name->slice()`.
413 * The `NodeTraverser` no longer clones nodes by default. The old behavior can be restored by
414   passing `true` to the constructor.
415 * The constructor for `Scalar` nodes no longer has a default value. E.g. `new LNumber()` should now
416   be written as `new LNumber(0)`.
417
418 ---
419
420 **This changelog only includes changes from the 2.0 series. For older changes see the
421 [1.x series changelog](https://github.com/nikic/PHP-Parser/blob/1.x/CHANGELOG.md) and the
422 [0.9 series changelog](https://github.com/nikic/PHP-Parser/blob/0.9/CHANGELOG.md).**