1--TEST-- 2Nullable types 3--FILE-- 4<?php 5 6require __DIR__ . '/../util.php'; 7 8$code = <<<'PHP' 9<?php 10function test(?Foo $foo) : ?Bar { 11} 12function test(?int $foo) : ?int { 13} 14function test(?array $foo) : ?array { 15} 16PHP; 17 18echo ast_dump(ast\parse_code($code, $version=70)); 19 20?> 21--EXPECT-- 22AST_STMT_LIST 23 0: AST_FUNC_DECL 24 name: "test" 25 docComment: null 26 params: AST_PARAM_LIST 27 0: AST_PARAM 28 type: AST_NULLABLE_TYPE 29 type: AST_NAME 30 flags: NAME_NOT_FQ (1) 31 name: "Foo" 32 name: "foo" 33 default: null 34 stmts: AST_STMT_LIST 35 returnType: AST_NULLABLE_TYPE 36 type: AST_NAME 37 flags: NAME_NOT_FQ (1) 38 name: "Bar" 39 __declId: 0 40 1: AST_FUNC_DECL 41 name: "test" 42 docComment: null 43 params: AST_PARAM_LIST 44 0: AST_PARAM 45 type: AST_NULLABLE_TYPE 46 type: AST_TYPE 47 flags: TYPE_LONG (4) 48 name: "foo" 49 default: null 50 stmts: AST_STMT_LIST 51 returnType: AST_NULLABLE_TYPE 52 type: AST_TYPE 53 flags: TYPE_LONG (4) 54 __declId: 1 55 2: AST_FUNC_DECL 56 name: "test" 57 docComment: null 58 params: AST_PARAM_LIST 59 0: AST_PARAM 60 type: AST_NULLABLE_TYPE 61 type: AST_TYPE 62 flags: TYPE_ARRAY (7) 63 name: "foo" 64 default: null 65 stmts: AST_STMT_LIST 66 returnType: AST_NULLABLE_TYPE 67 type: AST_TYPE 68 flags: TYPE_ARRAY (7) 69 __declId: 2 70