xref: /php-ast/tests/true_type.phpt (revision 260678d4)
1--TEST--
2'true' type parsing
3--FILE--
4<?php
5
6require __DIR__ . '/../util.php';
7
8$code = <<<'PHP'
9<?php
10function test(true $x): true {
11    return $x;
12}
13PHP;
14
15$node = ast\parse_code($code, $version=85);
16echo ast_dump($node), "\n";
17--EXPECTF--
18AST_STMT_LIST
19    0: AST_FUNC_DECL
20        name: "test"
21        docComment: null
22        params: AST_PARAM_LIST
23            0: AST_PARAM
24                type: AST_TYPE
25                    flags: TYPE_TRUE (%d)
26                name: "x"
27                default: null
28                attributes: null
29                docComment: null
30        stmts: AST_STMT_LIST
31            0: AST_RETURN
32                expr: AST_VAR
33                    name: "x"
34        returnType: AST_TYPE
35            flags: TYPE_TRUE (%d)
36        attributes: null
37        __declId: 0
38