mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
0d266a24d6
When we need to evaluate constant ASTs, we always have to do that in the scope where the constant has been defined, which may be a parent of the `ReflectionClass`'s scope. Closes GH-8106.
32 lines
451 B
PHP
32 lines
451 B
PHP
--TEST--
|
|
GH-8080 (ReflectionClass::getConstants() depends on def. order)
|
|
--FILE--
|
|
<?php
|
|
class A {
|
|
const LIST = [
|
|
self::TEST => 'Test',
|
|
];
|
|
private const TEST = 'test';
|
|
}
|
|
|
|
class B extends A {}
|
|
|
|
$r = new ReflectionClass(B::class);
|
|
var_dump(
|
|
$r->getConstants(),
|
|
$r->getConstant("LIST")
|
|
);
|
|
?>
|
|
--EXPECT--
|
|
array(1) {
|
|
["LIST"]=>
|
|
array(1) {
|
|
["test"]=>
|
|
string(4) "Test"
|
|
}
|
|
}
|
|
array(1) {
|
|
["test"]=>
|
|
string(4) "Test"
|
|
}
|