We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 96fe814 commit 0aaa862Copy full SHA for 0aaa862
ext/reflection/tests/ReflectionClassConstant_unset_name.phpt
@@ -0,0 +1,28 @@
1
+--TEST--
2
+Unsetting name on ReflectionClassConstant
3
+--FILE--
4
+<?php
5
+
6
+class Test {
7
+ public const C = 1;
8
+}
9
10
+// This is unsupported and the actual behavior doesn't matter.
11
+// Just make sure it doesn't crash.
12
+$rc = new ReflectionClassConstant(Test::class, 'C');
13
+unset($rc->name);
14
+try {
15
+ var_dump($rc->getName());
16
+} catch (Error $e) {
17
+ echo $e->getMessage(), "\n";
18
19
20
+ echo $rc, "\n";
21
22
23
24
25
+?>
26
+--EXPECT--
27
+Typed property ReflectionClassConstant::$name must not be accessed before initialization
28
0 commit comments