1--TEST--
2Property hooks in php 8.4 bodies
3--SKIPIF--
4<?php if (PHP_VERSION_ID < 80400) die('skip PHP >=8.4 only'); ?>
5--FILE--
6<?php
7
8require __DIR__ . '/../util.php';
9
10$code = <<<'PHP'
11<?php
12class A {
13    public string $normal;
14    public string $name {
15        set(string $newName) {
16            $this->name = $newName;
17        }
18    }
19}
20PHP;
21
22$node = ast\parse_code($code, $version=90);
23echo ast_dump($node), "\n";
24$node = ast\parse_code($code, $version=110);
25echo ast_dump($node), "\n";
26--EXPECTF--
27AST_STMT_LIST
28    0: AST_CLASS
29        name: "A"
30        docComment: null
31        extends: null
32        implements: null
33        stmts: AST_STMT_LIST
34            0: AST_PROP_GROUP
35                flags: MODIFIER_PUBLIC (1)
36                type: AST_TYPE
37                    flags: TYPE_STRING (6)
38                props: AST_PROP_DECL
39                    0: AST_PROP_ELEM
40                        name: "normal"
41                        default: null
42                        docComment: null
43                attributes: null
44            1: AST_PROP_GROUP
45                flags: MODIFIER_PUBLIC (1)
46                type: AST_TYPE
47                    flags: TYPE_STRING (6)
48                props: AST_PROP_DECL
49                    0: AST_PROP_ELEM
50                        name: "name"
51                        default: null
52                        docComment: null
53                attributes: null
54        attributes: null
55        type: null
56        __declId: 0
57AST_STMT_LIST
58    0: AST_CLASS
59        name: "A"
60        docComment: null
61        extends: null
62        implements: null
63        stmts: AST_STMT_LIST
64            0: AST_PROP_GROUP
65                flags: MODIFIER_PUBLIC (1)
66                type: AST_TYPE
67                    flags: TYPE_STRING (6)
68                props: AST_PROP_DECL
69                    0: AST_PROP_ELEM
70                        name: "normal"
71                        default: null
72                        docComment: null
73                        hooks: null
74                attributes: null
75            1: AST_PROP_GROUP
76                flags: MODIFIER_PUBLIC (1)
77                type: AST_TYPE
78                    flags: TYPE_STRING (6)
79                props: AST_PROP_DECL
80                    0: AST_PROP_ELEM
81                        name: "name"
82                        default: null
83                        docComment: null
84                        hooks: AST_STMT_LIST
85                            0: AST_PROPERTY_HOOK
86                                name: "set"
87                                docComment: null
88                                params: AST_PARAM_LIST
89                                    0: AST_PARAM
90                                        type: AST_TYPE
91                                            flags: TYPE_STRING (6)
92                                        name: "newName"
93                                        default: null
94                                        attributes: null
95                                        docComment: null
96                                        hooks: null
97                                stmts: AST_STMT_LIST
98                                    0: AST_ASSIGN
99                                        var: AST_PROP
100                                            expr: AST_VAR
101                                                name: "this"
102                                            prop: "name"
103                                        expr: AST_VAR
104                                            name: "newName"
105                                attributes: null
106                                __declId: 0
107                attributes: null
108        attributes: null
109        type: null
110        __declId: 1
111