2012-11-22 19:54:05 +01:00
|
|
|
Version 0.9.4-dev
|
2012-04-23 14:14:52 +02:00
|
|
|
-----------------
|
|
|
|
|
2013-02-14 21:49:08 +01:00
|
|
|
* [PHP 5.5] Add support for `ClassName::class`. This is parsed as an `Expr_ClassConstFetch` with `'class'` being the
|
|
|
|
constant name.
|
|
|
|
|
2013-01-15 17:26:20 +01:00
|
|
|
* Syntax errors now include information on expected tokens and mimic the format of PHP's own (pre 5.4) error messages.
|
|
|
|
Example:
|
|
|
|
|
|
|
|
Old: Unexpected token T_STATIC on line 1
|
|
|
|
New: Syntax error, unexpected T_STATIC, expecting T_STRING or T_NS_SEPARATOR or '{'
|
2012-11-22 19:54:05 +01:00
|
|
|
|
2013-01-15 17:43:36 +01:00
|
|
|
* `PHPParser_PrettyPrinter_Zend` was renamed to `PHPParser_PrettyPrinter_Default` as the default pretty printer only
|
|
|
|
very loosely applies the Zend Coding Standard. The class `PHPParser_PrettyPrinter_Zend` extends
|
|
|
|
`PHPParser_PrettyPrinter_Default` to maintain backwards compatibility.
|
|
|
|
|
2013-01-15 18:21:42 +01:00
|
|
|
* The pretty printer now prints namespaces in semicolon-style if possible (i.e. if the file does not contain a global
|
|
|
|
namespace declaration).
|
|
|
|
|
2012-11-22 19:54:05 +01:00
|
|
|
Version 0.9.3 (22.11.2012)
|
|
|
|
--------------------------
|
2012-11-22 19:51:21 +01:00
|
|
|
|
2012-09-07 23:31:36 +02:00
|
|
|
* [BC] As `list()` in `foreach` is now supported the structure of list assignments changed:
|
2012-09-07 23:21:23 +02:00
|
|
|
|
2012-12-21 13:26:58 +01:00
|
|
|
1. There is no longer a dedicated `AssignList` node; instead a normal `Assign` node is used with a `List` as `var`.
|
|
|
|
2. Nested lists are now `List` nodes too, instead of just arrays.
|
2012-09-07 23:21:23 +02:00
|
|
|
|
2012-09-07 23:31:36 +02:00
|
|
|
* [BC] As arbitrary expressions are allowed in `empty()` now its subnode was renamed from `var` to `expr`.
|
|
|
|
|
2012-11-22 19:51:21 +01:00
|
|
|
* [BC] The protected `pSafe()` method in `PrettyPrinterAbstract` was renamed to `pNoIndent()`.
|
|
|
|
|
2012-09-07 23:31:36 +02:00
|
|
|
* [PHP 5.5] Add support for arbitrary expressions in `empty()`.
|
|
|
|
|
2012-09-07 19:43:07 +02:00
|
|
|
* [PHP 5.5] Add support for constant array / string dereferencing.
|
|
|
|
Examples: `"foo"[2]`, `[1, 2, 3][2]`
|
|
|
|
|
2012-09-07 19:24:44 +02:00
|
|
|
* [PHP 5.5] Add support for `yield` expressions. This adds a new `Yield` expression type, with subnodes `key` and
|
|
|
|
`value`.
|
|
|
|
|
2012-09-07 18:06:11 +02:00
|
|
|
* [PHP 5.5] Add support for `finally`. This adds a new `finallyStmts` subnode to the `TryCatch` node. If there is no
|
|
|
|
finally clause it will be `null`.
|
|
|
|
|
2012-09-07 23:21:23 +02:00
|
|
|
* [PHP 5.5] Add support for `list()` destructuring of `foreach` values.
|
2012-09-07 17:22:43 +02:00
|
|
|
Example: `foreach ($coords as list($x, $y)) { ... }`
|
|
|
|
|
2012-11-22 19:51:21 +01:00
|
|
|
* Improve pretty printing of expressions by printing less unnecessary parentheses. In particular concatenations are now
|
|
|
|
printed as `$a . $b . $c . $d . $e` rather than `$a . ($b . ($c . ($d . $e)))`. This is implemented by taking operator
|
|
|
|
associativity into account. New protected methods added to the pretty printer are `pPrec()`, `pInfixOp()`,
|
|
|
|
`pPrefixOp()` and `pPostfixOp()`. This also fixes an issue with extraneous parentheses in closure bodies.
|
|
|
|
|
|
|
|
* Fix formatting of fall-through `case` statements in the Zend pretty printer.
|
|
|
|
|
2012-07-23 11:36:47 +02:00
|
|
|
* Fix parsing of `$foo =& new Bar`. It is now properly parsed as `AssignRef` (instead of `Assign`).
|
2012-07-07 22:23:25 +02:00
|
|
|
|
2012-11-22 19:51:21 +01:00
|
|
|
* Fix assignment of `$endAttributes`. Sometimes the attributes of the token right after the node were assigned, rather
|
|
|
|
than the attributes of the last token in the node.
|
|
|
|
|
|
|
|
* `rebuildParser.php` is now designed to be run from the command line rather than from the browser.
|
|
|
|
|
2012-07-07 22:23:25 +02:00
|
|
|
Version 0.9.2 (07.07.2012)
|
|
|
|
--------------------------
|
2012-09-07 23:21:23 +02:00
|
|
|
|
2012-07-07 16:24:07 +02:00
|
|
|
* Add `Class->getMethods()` function, which returns all methods contained in the `stmts` array of the class node. This
|
|
|
|
does not take inherited methods into account.
|
|
|
|
|
2012-07-07 16:08:37 +02:00
|
|
|
* Add `isPublic()`, `isProtected()`, `isPrivate()`. `isAbstract()`, `isFinal()` and `isStatic()` accessors to the
|
|
|
|
`ClassMethod`, `Property` and `Class` nodes. (`Property` and `Class` obviously only have the accessors relevant to
|
|
|
|
them.)
|
|
|
|
|
2012-05-12 14:15:24 +02:00
|
|
|
* Fix parsing of new expressions in parentheses, e.g. `return(new Foo);`.
|
|
|
|
|
2012-05-11 18:45:55 +02:00
|
|
|
* [BC] Due to the below changes nodes now optionally accept an `$attributes` array as the
|
|
|
|
last parameter, instead of the previously used `$line` and `$docComment` parameters.
|
|
|
|
|
2012-05-11 17:58:59 +02:00
|
|
|
* Add mechanism for adding attributes to nodes in the lexer.
|
|
|
|
|
|
|
|
The following attributes are now added by default:
|
|
|
|
|
|
|
|
* `startLine`: The line the node started in.
|
|
|
|
* `endLine`: The line the node ended in.
|
|
|
|
* `comments`: An array of comments. The comments are instances of `PHPParser_Comment`
|
|
|
|
(or `PHPParser_Comment_Doc` for doc comments).
|
|
|
|
|
|
|
|
The methods `getLine()` and `setLine()` still exist and function as before, but internally
|
|
|
|
operator on the `startLine` attribute.
|
|
|
|
|
|
|
|
`getDocComment()` also continues to exist. It returns the last comment in the `comments`
|
|
|
|
attribute if it is a doc comment, otherwise `null`. As `getDocComment()` now returns a
|
|
|
|
comment object (which can be modified using `->setText()`) the `setDocComment()` method was
|
|
|
|
removed. Comment objects implement a `__toString()` method, so `getDocComment()` should
|
|
|
|
continue to work properly with old code.
|
|
|
|
|
|
|
|
* [BC] Use inject-once approach for lexer:
|
|
|
|
|
|
|
|
Now the lexer is injected only once when creating the parser. Instead of
|
|
|
|
|
2012-05-12 14:15:24 +02:00
|
|
|
$parser = new PHPParser_Parser;
|
|
|
|
$parser->parse(new PHPParser_Lexer($code));
|
|
|
|
$parser->parse(new PHPParser_Lexer($code2));
|
2012-05-11 17:58:59 +02:00
|
|
|
|
|
|
|
you write:
|
|
|
|
|
2012-05-12 14:15:24 +02:00
|
|
|
$parser = new PHPParser_Parser(new PHPParser_Lexer);
|
|
|
|
$parser->parse($code);
|
|
|
|
$parser->parse($code2);
|
2012-05-11 17:58:59 +02:00
|
|
|
|
|
|
|
* Fix `NameResolver` visitor to also resolve class names in `catch` blocks.
|
2012-04-24 00:52:11 +02:00
|
|
|
|
|
|
|
Version 0.9.1 (24.04.2012)
|
|
|
|
--------------------------
|
|
|
|
|
2012-04-23 14:14:52 +02:00
|
|
|
* Add ability to add attributes to nodes:
|
|
|
|
|
|
|
|
It is now possible to add attributes to a node using `$node->setAttribute('name', 'value')` and to retrieve them using
|
|
|
|
`$node->getAttribute('name' [, 'default'])`. Additionally the existance of an attribute can be checked with
|
|
|
|
`$node->hasAttribute('name')` and all attributes can be returned using `$node->getAttributes()`.
|
|
|
|
|
|
|
|
* Add code generation features: Builders and templates.
|
|
|
|
|
|
|
|
For more infos, see the [code generation documentation][1].
|
|
|
|
|
|
|
|
* [BC] Don't traverse nodes merged by another visitor:
|
|
|
|
|
|
|
|
If a NodeVisitor returns an array of nodes to merge, these will no longer be traversed by all other visitors. This
|
|
|
|
behavior only caused problems.
|
|
|
|
|
2012-05-11 17:58:59 +02:00
|
|
|
* Fix line numbers for some list structures.
|
|
|
|
* Fix XML unserialization of empty nodes.
|
|
|
|
* Fix parsing of integers that overflow into floats.
|
|
|
|
* Fix emulation of NOWDOC and binary floats.
|
2012-04-23 14:14:52 +02:00
|
|
|
|
|
|
|
Version 0.9.0 (05.01.2012)
|
|
|
|
--------------------------
|
|
|
|
|
|
|
|
First version.
|
|
|
|
|
|
|
|
[1]: https://github.com/nikic/PHP-Parser/blob/master/doc/3_Code_generation.markdown
|