xref: /php-ast/tests/functions_dont_use.phpt (revision 260678d4)
1--TEST--
2Uses only make sense on closures
3--FILE--
4<?php
5
6require __DIR__ . '/../util.php';
7
8$code = <<<'PHP'
9<?php
10function() {};
11function test() {}
12PHP;
13
14echo ast_dump(ast\parse_code($code, $version=50)), "\n";
15echo ast_dump(ast\parse_code($code, $version=60)), "\n";
16
17?>
18--EXPECTF--
19
20Deprecated: ast\parse_code(): Version 50 is deprecated in %s.php on line 11
21AST_STMT_LIST
22    0: AST_CLOSURE
23        name: "{closure}"
24        docComment: null
25        params: AST_PARAM_LIST
26        uses: null
27        stmts: AST_STMT_LIST
28        returnType: null
29        __declId: 0
30    1: AST_FUNC_DECL
31        name: "test"
32        docComment: null
33        params: AST_PARAM_LIST
34        uses: null
35        stmts: AST_STMT_LIST
36        returnType: null
37        __declId: 1
38
39Deprecated: ast\parse_code(): Version 60 is deprecated in %s.php on line 12
40AST_STMT_LIST
41    0: AST_CLOSURE
42        name: "{closure}"
43        docComment: null
44        params: AST_PARAM_LIST
45        uses: null
46        stmts: AST_STMT_LIST
47        returnType: null
48        __declId: 0
49    1: AST_FUNC_DECL
50        name: "test"
51        docComment: null
52        params: AST_PARAM_LIST
53        stmts: AST_STMT_LIST
54        returnType: null
55        __declId: 1
56