Skip to content

Commit d806786

Browse files
committed
Deprecate version 20, mark 35 as default
1 parent d3853b9 commit d806786

File tree

8 files changed

+41
-27
lines changed

8 files changed

+41
-27
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,11 @@ Version changelog
440440
These will now be normalized to always use an `AST_STMT_LIST`. A `null` is only allowed if it is
441441
semantically meaningful, e.g. in the case of `declare(ticks=1);` vs `declare(ticks=1) {}`.
442442

443-
### 35 (in development)
443+
### 35 (current)
444+
445+
Supported since 2016-08-04.
446+
447+
This version normalizes the AST to PHP 7.1 format.
444448

445449
* The `class` node of `AST_CATCH` is now always represented as an `AST_NAME_LIST`. In lower
446450
versions: On PHP 7.0 it will always be an `AST_NAME`. In PHP 7.1 it will be an `AST_NAME` if
@@ -450,15 +454,15 @@ Version changelog
450454
`AST_ARRAY` if `list()` is used with keys. In PHP 7.1 destructuring using `[]` will always be
451455
represented using `AST_ARRAY`, independently of the version.
452456

453-
### 30 (current)
457+
### 30 (supported)
454458

455459
Supported since 2015-03-10.
456460

457461
* Use string names for child nodes of kinds with fixed length.
458462

459-
### 20 (supported)
463+
### 20 (deprecated)
460464

461-
Supported since 2015-12-14.
465+
Supported since 2015-12-14. Deprecated since 2016-08-04.
462466

463467
* `AST_GREATER`, `AST_GREATER_EQUAL`, `AST_OR`, `AST_AND` nodes are now represented using
464468
`AST_BINARY_OP` with flags `BINARY_IS_GREATER`, `BINARY_IS_GREATER_OR_EQUAL`, `BINARY_BOOL_OR`

ast.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#define AST_CACHE_SLOT_LINENO &AST_G(cache_slots)[2 * 2]
2929
#define AST_CACHE_SLOT_CHILDREN &AST_G(cache_slots)[2 * 3]
3030

31-
#define AST_CURRENT_VERSION 30
31+
#define AST_CURRENT_VERSION 35
3232

3333
/* Additional flags for BINARY_OP */
3434
#define AST_BINARY_IS_GREATER 256
@@ -602,7 +602,7 @@ static int ast_check_version(zend_long version) {
602602
zend_string *version_info;
603603

604604
if (ast_version_known(version)) {
605-
if (version == 10 || version == 15) {
605+
if (version == 10 || version == 15 || version == 20) {
606606
php_error_docref(NULL, E_DEPRECATED,
607607
"Version " ZEND_LONG_FMT " is deprecated", version);
608608
}

tests/assign_ops.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ AST_STMT_LIST
100100
0: "a"
101101
1: AST_VAR
102102
0: "b"
103+
104+
Deprecated: ast\parse_code(): Version 20 is deprecated in %s on line %d
103105
AST_STMT_LIST
104106
0: AST_ASSIGN_OP
105107
flags: BINARY_BITWISE_OR (9)

tests/binary_ops.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ AST_STMT_LIST
4040
0: "a"
4141
1: AST_VAR
4242
0: "b"
43+
44+
Deprecated: ast\parse_code(): Version 20 is deprecated in %s on line %d
4345
AST_STMT_LIST
4446
0: AST_BINARY_OP
4547
flags: BINARY_IS_GREATER (256)

tests/class_types.phpt

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,45 +15,45 @@ interface E {}
1515
new class {};
1616
PHP;
1717

18-
echo ast_dump(ast\parse_code($code, $version=20));
18+
echo ast_dump(ast\parse_code($code, $version=30));
1919

2020
?>
2121
--EXPECT--
2222
AST_STMT_LIST
2323
0: AST_CLASS
2424
flags: 0
2525
name: A
26-
0: null
27-
1: null
28-
2: AST_STMT_LIST
26+
extends: null
27+
implements: null
28+
stmts: AST_STMT_LIST
2929
1: AST_CLASS
3030
flags: CLASS_ABSTRACT (32)
3131
name: B
32-
0: null
33-
1: null
34-
2: AST_STMT_LIST
32+
extends: null
33+
implements: null
34+
stmts: AST_STMT_LIST
3535
2: AST_CLASS
3636
flags: CLASS_FINAL (4)
3737
name: C
38-
0: null
39-
1: null
40-
2: AST_STMT_LIST
38+
extends: null
39+
implements: null
40+
stmts: AST_STMT_LIST
4141
3: AST_CLASS
4242
flags: CLASS_TRAIT (128)
4343
name: D
44-
0: null
45-
1: null
46-
2: AST_STMT_LIST
44+
extends: null
45+
implements: null
46+
stmts: AST_STMT_LIST
4747
4: AST_CLASS
4848
flags: CLASS_INTERFACE (64)
4949
name: E
50-
0: null
51-
1: null
52-
2: AST_STMT_LIST
50+
extends: null
51+
implements: null
52+
stmts: AST_STMT_LIST
5353
5: AST_NEW
54-
0: AST_CLASS
54+
class: AST_CLASS
5555
flags: CLASS_ANONYMOUS (256)
56-
0: null
57-
1: null
58-
2: AST_STMT_LIST
59-
1: AST_ARG_LIST
56+
extends: null
57+
implements: null
58+
stmts: AST_STMT_LIST
59+
args: AST_ARG_LIST

tests/nested_stat_lists.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ AST_STMT_LIST
4646
0: "f"
4747
2: AST_VAR
4848
0: "g"
49+
50+
Deprecated: ast\parse_code(): Version 20 is deprecated in %s on line %d
4951
AST_STMT_LIST
5052
0: AST_VAR
5153
0: "a"

tests/try_catch_finally.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ AST_STMT_LIST
5454
0: AST_STMT_LIST
5555
0: AST_ECHO
5656
0: "finally"
57+
58+
Deprecated: ast\parse_code(): Version 20 is deprecated in %s on line %d
5759
AST_STMT_LIST
5860
0: AST_TRY
5961
0: AST_STMT_LIST

tests/unary_ops.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ AST_STMT_LIST
2626
0: 1
2727
2: AST_UNARY_MINUS
2828
0: 1
29+
30+
Deprecated: ast\parse_code(): Version 20 is deprecated in %s on line %d
2931
AST_STMT_LIST
3032
0: AST_UNARY_OP
3133
flags: UNARY_SILENCE (260)

0 commit comments

Comments
 (0)