xref: /PHP-8.2/ext/reflection/tests/gh8080.phpt (revision 0d266a24)
1--TEST--
2GH-8080 (ReflectionClass::getConstants() depends on def. order)
3--FILE--
4<?php
5class A {
6    const LIST = [
7        self::TEST => 'Test',
8    ];
9    private const TEST = 'test';
10}
11
12class B extends A {}
13
14$r = new ReflectionClass(B::class);
15var_dump(
16    $r->getConstants(),
17    $r->getConstant("LIST")
18);
19?>
20--EXPECT--
21array(1) {
22  ["LIST"]=>
23  array(1) {
24    ["test"]=>
25    string(4) "Test"
26  }
27}
28array(1) {
29  ["test"]=>
30  string(4) "Test"
31}
32