Skip to content

Commit 0aaa862

Browse files
committed
Add test for unsetting ReflectionClassConstant::$name
This test was supposed to be part of 50b4a7a.
1 parent 96fe814 commit 0aaa862

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
try {
20+
echo $rc, "\n";
21+
} catch (Error $e) {
22+
echo $e->getMessage(), "\n";
23+
}
24+
25+
?>
26+
--EXPECT--
27+
Typed property ReflectionClassConstant::$name must not be accessed before initialization
28+
Typed property ReflectionClassConstant::$name must not be accessed before initialization

0 commit comments

Comments
 (0)