Skip to content

Commit ab30047

Browse files
committed
Deprecate version 10
1 parent 7b051eb commit ab30047

File tree

8 files changed

+26
-14
lines changed

8 files changed

+26
-14
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,11 @@ ZEND_AST_USE
413413
Version changelog
414414
-----------------
415415

416-
### 30 (current)
416+
### 30 (current; 2015-03-10)
417417

418418
* Use string names for child nodes of kinds with fixed length.
419419

420-
### 20 (supported)
420+
### 20 (supported; 2015-12-14)
421421

422422
* `AST_GREATER`, `AST_GREATER_EQUAL`, `AST_OR`, `AST_AND` nodes are now represented using
423423
`AST_BINARY_OP` with flags `BINARY_IS_GREATER`, `BINARY_IS_GREATER_OR_EQUAL`, `BINARY_BOOL_OR`
@@ -429,13 +429,13 @@ Version changelog
429429
it was a simple string containing the name.
430430
* Nested `AST_STMT_LIST`s are now flattened out.
431431

432-
### 15 (supported)
432+
### 15 (supported; 2015-10-21)
433433

434434
* In line with an upstream change, the `docComment` property on `AST_PROP_DECL` has been moved to
435435
`AST_PROP_ELEM`. This means that each property in one property declaration can have its own
436436
doc comment.
437437

438-
### 10 (supported)
438+
### 10 (deprecated)
439439

440440
Initial.
441441

ast.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,14 +382,25 @@ static zend_string *ast_version_info() {
382382
return str.s;
383383
}
384384

385-
static int ast_check_version(zend_long version) {
385+
static inline zend_bool ast_version_known(zend_long version) {
386386
size_t i;
387-
zend_string *version_info;
388-
389387
for (i = 0; i < versions_count; ++i) {
390388
if (version == versions[i]) {
391-
return SUCCESS;
389+
return 1;
390+
}
391+
}
392+
return 0;
393+
}
394+
395+
static int ast_check_version(zend_long version) {
396+
zend_string *version_info;
397+
398+
if (ast_version_known(version)) {
399+
if (version == 10) {
400+
php_error_docref(NULL, E_DEPRECATED,
401+
"Version " ZEND_LONG_FMT " is deprecated", version);
392402
}
403+
return SUCCESS;
393404
}
394405

395406
version_info = ast_version_info();

tests/assign_ops.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $a <<= $b;
2121
$a >>= $b;
2222
PHP;
2323

24-
echo ast_dump(ast\parse_code($code, $version=10)), "\n";
24+
echo ast_dump(ast\parse_code($code, $version=15)), "\n";
2525
echo ast_dump(ast\parse_code($code, $version=20)), "\n";
2626

2727
?>

tests/binary_ops.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ $a and $b;
1313
$a or $b;
1414
PHP;
1515

16-
echo ast_dump(ast\parse_code($code, $version=10)), "\n";
16+
echo ast_dump(ast\parse_code($code, $version=15)), "\n";
1717
echo ast_dump(ast\parse_code($code, $version=20)), "\n";
1818

1919
?>

tests/nested_stat_lists.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $a;
2222
$g;
2323
PHP;
2424

25-
echo ast_dump(ast\parse_code($code, $version=10)), "\n";
25+
echo ast_dump(ast\parse_code($code, $version=15)), "\n";
2626
echo ast_dump(ast\parse_code($code, $version=20)), "\n";
2727

2828
?>

tests/prop_doc_comments.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ echo ast_dump(ast\parse_code($code, $version=10)), "\n";
2424
echo ast_dump(ast\parse_code($code, $version=15)), "\n";
2525

2626
?>
27-
--EXPECT--
27+
--EXPECTF--
28+
Deprecated: ast\parse_code(): Version 10 is deprecated in %s on line %d
2829
AST_STMT_LIST
2930
0: AST_CLASS
3031
flags: 0

tests/try_catch_finally.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ try {
1818
}
1919
PHP;
2020

21-
echo ast_dump(ast\parse_code($code, $version=10)), "\n";
21+
echo ast_dump(ast\parse_code($code, $version=15)), "\n";
2222
echo ast_dump(ast\parse_code($code, $version=20)), "\n";
2323

2424
?>

tests/unary_ops.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $code = <<<'PHP'
1212
-1;
1313
PHP;
1414

15-
echo ast_dump(ast\parse_code($code, $version=10)), "\n";
15+
echo ast_dump(ast\parse_code($code, $version=15)), "\n";
1616
echo ast_dump(ast\parse_code($code, $version=20)), "\n";
1717

1818
?>

0 commit comments

Comments
 (0)