Skip to content

Commit 17a63a0

Browse files
committed
Add tests of php 8.2 constants in traits
1 parent db0840e commit 17a63a0

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed

tests/cases/parser/traits26.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
trait X {
3+
const C = 5;
4+
public const D = 6;
5+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
{
2+
"SourceFileNode": {
3+
"statementList": [
4+
{
5+
"InlineHtml": {
6+
"scriptSectionEndTag": null,
7+
"text": null,
8+
"scriptSectionStartTag": {
9+
"kind": "ScriptSectionStartTag",
10+
"textLength": 6
11+
}
12+
}
13+
},
14+
{
15+
"TraitDeclaration": {
16+
"attributes": null,
17+
"traitKeyword": {
18+
"kind": "TraitKeyword",
19+
"textLength": 5
20+
},
21+
"name": {
22+
"kind": "Name",
23+
"textLength": 1
24+
},
25+
"traitMembers": {
26+
"TraitMembers": {
27+
"openBrace": {
28+
"kind": "OpenBraceToken",
29+
"textLength": 1
30+
},
31+
"traitMemberDeclarations": [
32+
{
33+
"ClassConstDeclaration": {
34+
"attributes": null,
35+
"modifiers": [],
36+
"constKeyword": {
37+
"kind": "ConstKeyword",
38+
"textLength": 5
39+
},
40+
"constElements": {
41+
"ConstElementList": {
42+
"children": [
43+
{
44+
"ConstElement": {
45+
"name": {
46+
"kind": "Name",
47+
"textLength": 1
48+
},
49+
"equalsToken": {
50+
"kind": "EqualsToken",
51+
"textLength": 1
52+
},
53+
"assignment": {
54+
"NumericLiteral": {
55+
"children": {
56+
"kind": "IntegerLiteralToken",
57+
"textLength": 1
58+
}
59+
}
60+
}
61+
}
62+
}
63+
]
64+
}
65+
},
66+
"semicolon": {
67+
"kind": "SemicolonToken",
68+
"textLength": 1
69+
}
70+
}
71+
},
72+
{
73+
"ClassConstDeclaration": {
74+
"attributes": null,
75+
"modifiers": [
76+
{
77+
"kind": "PublicKeyword",
78+
"textLength": 6
79+
}
80+
],
81+
"constKeyword": {
82+
"kind": "ConstKeyword",
83+
"textLength": 5
84+
},
85+
"constElements": {
86+
"ConstElementList": {
87+
"children": [
88+
{
89+
"ConstElement": {
90+
"name": {
91+
"kind": "Name",
92+
"textLength": 1
93+
},
94+
"equalsToken": {
95+
"kind": "EqualsToken",
96+
"textLength": 1
97+
},
98+
"assignment": {
99+
"NumericLiteral": {
100+
"children": {
101+
"kind": "IntegerLiteralToken",
102+
"textLength": 1
103+
}
104+
}
105+
}
106+
}
107+
}
108+
]
109+
}
110+
},
111+
"semicolon": {
112+
"kind": "SemicolonToken",
113+
"textLength": 1
114+
}
115+
}
116+
}
117+
],
118+
"closeBrace": {
119+
"kind": "CloseBraceToken",
120+
"textLength": 1
121+
}
122+
}
123+
}
124+
}
125+
}
126+
],
127+
"endOfFileToken": {
128+
"kind": "EndOfFileToken",
129+
"textLength": 0
130+
}
131+
}
132+
}

0 commit comments

Comments
 (0)