Changelog for ast |
Release |
What has changed? |
1.1.2 |
- Fix compilation errors in PHP 8.4.
- In version 110, `AST_PARAM` and `AST_PROP_ELEM` nodes have a `hooks` node for property hooks (https://wiki.php.net/rfc/property-hooks)
- In version 110, `AST_CLOSURE` and `AST_ARROW_FUNC` nodes have no `name`. |
1.1.1 |
- Added support for PHP 8.3
- In version 100, `AST_CLASS_CONST_GROUP` nodes have a `type` child node to represent typed class constants. |
1.1.0 |
- Change documentation files to properly namespace attributes as `#[\AllowDynamicProperties]`. The reflection attributes are already correct.
- Deprecated AST versions 50 and 60.
- Drop support for php <= 7.1
- Fix test failures seen in php 8.2.0beta2 due to change to var_export's output format.
- Add support for php 8.2 readonly classes. Add `ast\flags\CLASS_READONLY` constant.
- Add support for php 8.2 `true` type. Add `ast\flags\TYPE_TRUE` constant.
- Fix bug in php 8.2 where ZEND_AST_ARROW_FUNC output did not include the stub `AST_RETURN` node that was included in php 8.1 and below. |
1.0.16 |
- Optimize instantiating properties of ast\Node and ast\Metadata.
- Document that ast\Node implements `#[AllowDynamicProperties]` in php 8.2 |
1.0.15 |
- Allow ast\Node to have dynamic properties without emitting a notice in PHP 8.2. |
1.0.14 |
- Support php 8.1 readonly properties with the flag 'MODIFIER_READONLY'
- Support php 8.1 first-class callable syntax, add the node kind 'AST_CALLABLE_CONVERT'
- Change the current AST version from 80 to the new version 90. AST version 85 is no longer experimental. |
1.0.13 |
- Indicate in metadata that 'AST_CLASS_CONST_GROUP' and 'AST_CLASS_CONST_DECL' can have MODIFIER_FINAL
(and any modifier a class element can have, to reflect what the parser can actually parse)
- Support php 8.1 intersection types, add node kind 'AST_TYPE_INTERSECTION' |
1.0.12 |
- Support parsing 'docComment' on php 8.1 enums |
1.0.11 |
- Add the experimental AST version 85.
- Support php 8.1 enums, add 'type' (for enum type) to AST_CLASS nodes in AST version 85+.
- Support php 8.1 'never' return type. |
1.0.10 |
- Support attributes syntax change (`#[...]`) in php 8.0.0RC1.
- Change the current AST version from 70 to 80. AST version 80 is no longer experimental.
- Add `ReflectionParameter` defaults for `ast\parse_code` and `ast\get_supported_versions` in php 8.
- Add parameter types and return types to reflection for various global functions.
php-ast was already throwing a `TypeError` when invalid parameter types were received.
- Always throw instead of warning when invalid parameters are passed to the ast\Node constructor. |
1.0.9 |
- Support API change in php 8.0.0beta3. |
1.0.8 |
- Recommend using the new constant `ast\flags\PARAM_MODIFIER_*` when checking if parameters use constructor property promotion.
The values of `ast\flags\MODIFIER_*` and `ast\flags\PARAM_VARIADIC` had some overlap in some php 7 versions.
The new constants will have the same values as `ast\flags\MODIFIER_*` in PHP 8.0+, but different values in PHP 7
(and these flags will never be set in php 7).
- Support PHP 8.0's named arguments.
- Support PHP 8.0's nullsafe operator (`?->`). |
1.0.7 |
- Add the experimental AST version 80
- In AST version 80, support returning `mixed` types as an `AST_TYPE` with type `TYPE_MIXED` instead of an `AST_NAME`.
- In AST version 80, support PHP 8.0 attributes for declarations.
- Support PHP 8.0's Match expressions.
- Support PHP 8.0 constructor property promotion, and allow indicating visibility on AST nodes.
Note that `MODIFIER_PUBLIC` and `ast\AST_PARAM` modifiers had overlap in php 7.4,
so the `MODIFIER_*` modifiers are only included in the provided metadata for php 8.0+ |
1.0.6 |
- Support TYPE_STATIC for the php 8.0 static return type. |
1.0.5 |
- Add ast\flags\TYPE_FALSE to support PHP 8.0 Union Types. |
1.0.4 |
- Add AST_TYPE_UNION to support PHP 8.0 Union Types. |
1.0.3 |
- Fix build error in php 7.4.0alpha3.
- Add `DIM_ALTERNATIVE_SYNTAX` as a flag of `AST_DIM` for `$x{'offset'}` (for php 7.4+)
- Add `PARENTHESIZED_CONDITIONAL` as a flag of `AST_CONDITIONAL` for `($a ? $b : $c)` (for php 7.4+)
- Bugfix: Make `ast\kind_uses_flags(ast\AST_ARROW_FUNC)` true in php 7.3 and lower. |
1.0.2 |
- Fix compatibility with (currently) PHP 7.4 and PHP 8.0.
- Support AST_ARROW_FUNC for PHP 7.4.
- Make $version a required parameter for `ast\parse_*`. Previously, the absence would throw a LogicException.
- Make AST version 70 the current version. |
1.0.1 |
- Fix compatibility with (currenty) PHP 7.4 and PHP 8.0.
- Support BINARY_COALESCE as a flag of AST_ASSIGN_OP for the `??=` operator added in PHP 7.4.
- Add AST version 70 (experimental):
- Version 70 adds AST_PROP_GROUP with type information for property groups.
- Version 70 adds AST_CLASS_NAME for `Foo::class`. Previously this used AST_CLASS_CONST |
1.0.0 |
This release is the same as version 0.1.7 with obsolete and deprecated functionality removed.
- Removed AST versions prior to version 50.
- Removed ast\Node\Decl class, which is no longer used.
- Removed AST kinds AST_AND, AST_COALESCE, AST_GREATER, AST_GREATER_EQUAL, AST_OR, AST_SILENCE,
AST_UNARY_MINUS, and AST_UNARY_PLUS, which are no longer used.
- Removed ASSIGN_* AST flags, which are no longer used. |
0.1.7 |
- Added AST version 60 with the following changes:
- `AST_FUNC_DECL` and `AST_METHOD` no longer generate a `uses` child. Previously this child was
always `null`.
- `AST_FUNC_CONST_ELEM` now always has a `docComment` child. Previously it was absent on PHP 7.0.
On PHP 7.0 the value is always `null`.
- Added `ARRAY_ELEM_REF` flag, which is used by `AST_ARRAY_ELEM` for by-reference array elements
and (since PHP 7.3) for by-reference destructuring. Previously this flag was represented simply
by the value `1`.
- Deprecated AST versions 40 and 45.
- Fix build against PHP 7.4-dev. |
0.1.6 |
- Added ast\get_metadata() function, which returns an array of ast\Metadata objects, one for each
AST kind. The metadata contains information such as the supported flags for the kind.
- Added ast\get_supported_versions() function, which provides an array of currently supported AST
versions. |
0.1.5 |
- Fix issue #51: Make nullable array/callable have a flag of 0 in inner element, in version 40.
- Added a constructor for the ast\Node class.
- Added ast\flags\FUNC_GENERATOR constant, which is used since PHP 7.1.
- Added ast\flags\FUNC_RETURNS_REF constant, intended to supersede ast\flags\RETURNS_REF.
- Added ast\flags\CLOSURE_USE_REF constant, used by AST_CLOSURE_VAR nodes. Previously "1" was used.
- Added version 45 with the following changes (PHP 7.2 support):
- An `object` type annotation now returns an `AST_TYPE` with `TYPE_OBJECT` flag, rather than
treating `object` as a class name.
- Added version 50 with the following changes:
- `ast\Node\Decl` nodes are no longer generated. AST kinds `AST_FUNCTION`, `AST_METHOD`,
`AST_CLOSURE` and `AST_CLASS` now also use the normal `ast\Node` class. The `name` and
`docComment` properties are now represented as children. The `endLineno` is still represented as
an (undeclared) property.
- An integer `__declId` has been added to declaration nodes of kind `AST_FUNCTION`, `AST_METHOD`,
`AST_CLOSURE` and `AST_CLASS`. The `__declId` uniquely identifies a declaration within the
parsed code and will remain the same if the code is parsed again. This is useful to distinguish
closures declared on the same line, or multiple conditional declarations using the same name.
The ID is not unique across different codes/files.
- `\ast\parse_file` will now consistently return an empty statement list (similar to
`\ast\parse_code`) if it is was passed a zero-byte file. Previously, it would return `null`. |