Skip to content

Commit d04a1d6

Browse files
Added test
1 parent 381b82c commit d04a1d6

File tree

2 files changed

+135
-0
lines changed

2 files changed

+135
-0
lines changed

package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
<file name="assign_ops.phpt" role="test" />
5353
<file name="ast_dump_with_exclude_doc.phpt" role="test" />
5454
<file name="ast_dump_with_linenos.phpt" role="test" />
55+
<file name="asymmetric_visibility.phpt" role="test" />
5556
<file name="attributes_01.phpt" role="test" />
5657
<file name="attributes_02.phpt" role="test" />
5758
<file name="binary_ops.phpt" role="test" />

tests/asymmetric_visibility.phpt

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
--TEST--
2+
Asymmetric Visibility in php 8.4
3+
--SKIPIF--
4+
<?php if (PHP_VERSION_ID < 80400) die('skip PHP >=8.4 only'); ?>
5+
--FILE--
6+
<?php
7+
require __DIR__ . '/../util.php';
8+
$code = <<<'PHP'
9+
<?php
10+
class PublicPropsWithAV
11+
{
12+
public public(set) int $p1 = 0;
13+
public protected(set) int $p2 = 0;
14+
public private(set) int $p3 = 0;
15+
protected public(set) int $p4 = 0;
16+
protected protected(set) int $p5 = 0;
17+
protected private(set) int $p6 = 0;
18+
private public(set) int $p7 = 0;
19+
private protected(set) int $pp8 = 0;
20+
private private(set) int $p9 = 0;
21+
}
22+
PHP;
23+
$node = ast\parse_code($code, $version=110);
24+
echo ast_dump($node), "\n";
25+
--EXPECTF--
26+
AST_STMT_LIST
27+
0: AST_CLASS
28+
name: "PublicPropsWithAV"
29+
docComment: null
30+
extends: null
31+
implements: null
32+
stmts: AST_STMT_LIST
33+
0: AST_PROP_GROUP
34+
flags: MODIFIER_PUBLIC | MODIFIER_PUBLIC_SET (1025)
35+
type: AST_TYPE
36+
flags: TYPE_LONG (4)
37+
props: AST_PROP_DECL
38+
0: AST_PROP_ELEM
39+
name: "p1"
40+
default: 0
41+
docComment: null
42+
hooks: null
43+
attributes: null
44+
1: AST_PROP_GROUP
45+
flags: MODIFIER_PUBLIC | MODIFIER_PROTECTED_SET (2049)
46+
type: AST_TYPE
47+
flags: TYPE_LONG (4)
48+
props: AST_PROP_DECL
49+
0: AST_PROP_ELEM
50+
name: "p2"
51+
default: 0
52+
docComment: null
53+
hooks: null
54+
attributes: null
55+
2: AST_PROP_GROUP
56+
flags: MODIFIER_PUBLIC | MODIFIER_PRIVATE_SET (4097)
57+
type: AST_TYPE
58+
flags: TYPE_LONG (4)
59+
props: AST_PROP_DECL
60+
0: AST_PROP_ELEM
61+
name: "p3"
62+
default: 0
63+
docComment: null
64+
hooks: null
65+
attributes: null
66+
3: AST_PROP_GROUP
67+
flags: MODIFIER_PROTECTED | MODIFIER_PUBLIC_SET (1026)
68+
type: AST_TYPE
69+
flags: TYPE_LONG (4)
70+
props: AST_PROP_DECL
71+
0: AST_PROP_ELEM
72+
name: "p4"
73+
default: 0
74+
docComment: null
75+
hooks: null
76+
attributes: null
77+
4: AST_PROP_GROUP
78+
flags: MODIFIER_PROTECTED | MODIFIER_PROTECTED_SET (2050)
79+
type: AST_TYPE
80+
flags: TYPE_LONG (4)
81+
props: AST_PROP_DECL
82+
0: AST_PROP_ELEM
83+
name: "p5"
84+
default: 0
85+
docComment: null
86+
hooks: null
87+
attributes: null
88+
5: AST_PROP_GROUP
89+
flags: MODIFIER_PROTECTED | MODIFIER_PRIVATE_SET (4098)
90+
type: AST_TYPE
91+
flags: TYPE_LONG (4)
92+
props: AST_PROP_DECL
93+
0: AST_PROP_ELEM
94+
name: "p6"
95+
default: 0
96+
docComment: null
97+
hooks: null
98+
attributes: null
99+
6: AST_PROP_GROUP
100+
flags: MODIFIER_PRIVATE | MODIFIER_PUBLIC_SET (1028)
101+
type: AST_TYPE
102+
flags: TYPE_LONG (4)
103+
props: AST_PROP_DECL
104+
0: AST_PROP_ELEM
105+
name: "p7"
106+
default: 0
107+
docComment: null
108+
hooks: null
109+
attributes: null
110+
7: AST_PROP_GROUP
111+
flags: MODIFIER_PRIVATE | MODIFIER_PROTECTED_SET (2052)
112+
type: AST_TYPE
113+
flags: TYPE_LONG (4)
114+
props: AST_PROP_DECL
115+
0: AST_PROP_ELEM
116+
name: "pp8"
117+
default: 0
118+
docComment: null
119+
hooks: null
120+
attributes: null
121+
8: AST_PROP_GROUP
122+
flags: MODIFIER_PRIVATE | MODIFIER_PRIVATE_SET (4100)
123+
type: AST_TYPE
124+
flags: TYPE_LONG (4)
125+
props: AST_PROP_DECL
126+
0: AST_PROP_ELEM
127+
name: "p9"
128+
default: 0
129+
docComment: null
130+
hooks: null
131+
attributes: null
132+
attributes: null
133+
type: null
134+
__declId: 0

0 commit comments

Comments
 (0)