1--TEST--
2Test semi-reserved words as class constants
3--FILE--
4<?php
5
6class Obj
7{
8    const EMPTY = 'empty';
9    const CALLABLE = 'callable';
10    const TRAIT = 'trait';
11    const EXTENDS = 'extends';
12    const IMPLEMENTS = 'implements';
13    const STATIC = 'static';
14    const ABSTRACT = 'abstract';
15    const FINAL = 'final';
16    const PUBLIC = 'public';
17    const PROTECTED = 'protected';
18    const PRIVATE = 'private';
19    const CONST = 'const';
20    const ENDDECLARE = 'enddeclare';
21    const ENDFOR = 'endfor';
22    const ENDFOREACH = 'endforeach';
23    const ENDIF = 'endif';
24    const ENDWHILE = 'endwhile';
25    const AND = 'and';
26    const GLOBAL = 'global';
27    const GOTO = 'goto';
28    const INSTANCEOF = 'instanceof';
29    const INSTEADOF = 'insteadof';
30    const INTERFACE = 'interface';
31    const NAMESPACE = 'namespace';
32    const NEW = 'new';
33    const OR = 'or';
34    const XOR = 'xor';
35    const TRY = 'try';
36    const USE = 'use';
37    const VAR = 'var';
38    const EXIT = 'exit';
39    const LIST = 'list';
40    const CLONE = 'clone';
41    const INCLUDE = 'include';
42    const INCLUDE_ONCE = 'include_once';
43    const THROW = 'throw';
44    const ARRAY = 'array';
45    const PRINT = 'print';
46    const ECHO = 'echo';
47    const REQUIRE = 'require';
48    const REQUIRE_ONCE = 'require_once';
49    const RETURN = 'return';
50    const ELSE = 'else';
51    const ELSEIF = 'elseif';
52    const DEFAULT = 'default';
53    const BREAK = 'break';
54    const CONTINUE = 'continue';
55    const SWITCH = 'switch';
56    const YIELD = 'yield';
57    const FUNCTION = 'function';
58    const FN = 'fn';
59    const IF = 'if';
60    const ENDSWITCH = 'endswitch';
61    const FINALLY = 'finally';
62    const FOR = 'for';
63    const FOREACH = 'foreach';
64    const DECLARE = 'declare';
65    const CASE = 'case';
66    const DO = 'do';
67    const WHILE = 'while';
68    const AS = 'as';
69    const CATCH = 'catch';
70    const DIE = 'die';
71    const SELF = 'self';
72    const PARENT = 'parent';
73    const ISSET = 'isset';
74    const UNSET = 'unset';
75    const __CLASS__ = '__CLASS__';
76    const __TRAIT__ = '__TRAIT__';
77    const __FUNCTION__ = '__FUNCTION__';
78    const __METHOD__ = '__METHOD__';
79    const __LINE__ = '__LINE__';
80    const __FILE__ = '__FILE__';
81    const __DIR__ = '__DIR__';
82    const __NAMESPACE__ = '__NAMESPACE__';
83}
84
85echo Obj::EMPTY, PHP_EOL;
86echo Obj::CALLABLE, PHP_EOL;
87echo Obj::TRAIT, PHP_EOL;
88echo Obj::EXTENDS, PHP_EOL;
89echo Obj::IMPLEMENTS, PHP_EOL;
90echo Obj::STATIC, PHP_EOL;
91echo Obj::ABSTRACT, PHP_EOL;
92echo Obj::FINAL, PHP_EOL;
93echo Obj::PUBLIC, PHP_EOL;
94echo Obj::PROTECTED, PHP_EOL;
95echo Obj::PRIVATE, PHP_EOL;
96echo Obj::CONST, PHP_EOL;
97echo Obj::ENDDECLARE, PHP_EOL;
98echo Obj::ENDFOR, PHP_EOL;
99echo Obj::ENDFOREACH, PHP_EOL;
100echo Obj::ENDIF, PHP_EOL;
101echo Obj::ENDWHILE, PHP_EOL;
102echo Obj::AND, PHP_EOL;
103echo Obj::GLOBAL, PHP_EOL;
104echo Obj::GOTO, PHP_EOL;
105echo Obj::INSTANCEOF, PHP_EOL;
106echo Obj::INSTEADOF, PHP_EOL;
107echo Obj::INTERFACE, PHP_EOL;
108echo Obj::NAMESPACE, PHP_EOL;
109echo Obj::NEW, PHP_EOL;
110echo Obj::OR, PHP_EOL;
111echo Obj::XOR, PHP_EOL;
112echo Obj::TRY, PHP_EOL;
113echo Obj::USE, PHP_EOL;
114echo Obj::VAR, PHP_EOL;
115echo Obj::EXIT, PHP_EOL;
116echo Obj::LIST, PHP_EOL;
117echo Obj::CLONE, PHP_EOL;
118echo Obj::INCLUDE, PHP_EOL;
119echo Obj::INCLUDE_ONCE, PHP_EOL;
120echo Obj::THROW, PHP_EOL;
121echo Obj::ARRAY, PHP_EOL;
122echo Obj::PRINT, PHP_EOL;
123echo Obj::ECHO, PHP_EOL;
124echo Obj::REQUIRE, PHP_EOL;
125echo Obj::REQUIRE_ONCE, PHP_EOL;
126echo Obj::RETURN, PHP_EOL;
127echo Obj::ELSE, PHP_EOL;
128echo Obj::ELSEIF, PHP_EOL;
129echo Obj::DEFAULT, PHP_EOL;
130echo Obj::BREAK, PHP_EOL;
131echo Obj::CONTINUE, PHP_EOL;
132echo Obj::SWITCH, PHP_EOL;
133echo Obj::YIELD, PHP_EOL;
134echo Obj::FUNCTION, PHP_EOL;
135echo Obj::FN, PHP_EOL;
136echo Obj::IF, PHP_EOL;
137echo Obj::ENDSWITCH, PHP_EOL;
138echo Obj::FINALLY, PHP_EOL;
139echo Obj::FOR, PHP_EOL;
140echo Obj::FOREACH, PHP_EOL;
141echo Obj::DECLARE, PHP_EOL;
142echo Obj::CASE, PHP_EOL;
143echo Obj::DO, PHP_EOL;
144echo Obj::WHILE, PHP_EOL;
145echo Obj::AS, PHP_EOL;
146echo Obj::CATCH, PHP_EOL;
147echo Obj::DIE, PHP_EOL;
148echo Obj::SELF, PHP_EOL;
149echo Obj::PARENT, PHP_EOL;
150echo Obj::ISSET, PHP_EOL;
151echo Obj::UNSET, PHP_EOL;
152echo Obj::__CLASS__, PHP_EOL;
153echo Obj::__TRAIT__, PHP_EOL;
154echo Obj::__FUNCTION__, PHP_EOL;
155echo Obj::__METHOD__, PHP_EOL;
156echo Obj::__LINE__, PHP_EOL;
157echo Obj::__FILE__, PHP_EOL;
158echo Obj::__DIR__, PHP_EOL;
159echo Obj::__NAMESPACE__, PHP_EOL;
160
161echo "\nDone\n";
162?>
163--EXPECT--
164empty
165callable
166trait
167extends
168implements
169static
170abstract
171final
172public
173protected
174private
175const
176enddeclare
177endfor
178endforeach
179endif
180endwhile
181and
182global
183goto
184instanceof
185insteadof
186interface
187namespace
188new
189or
190xor
191try
192use
193var
194exit
195list
196clone
197include
198include_once
199throw
200array
201print
202echo
203require
204require_once
205return
206else
207elseif
208default
209break
210continue
211switch
212yield
213function
214fn
215if
216endswitch
217finally
218for
219foreach
220declare
221case
222do
223while
224as
225catch
226die
227self
228parent
229isset
230unset
231__CLASS__
232__TRAIT__
233__FUNCTION__
234__METHOD__
235__LINE__
236__FILE__
237__DIR__
238__NAMESPACE__
239
240Done
241