1--TEST--
2Test variations of getting typed class constant values
3--FILE--
4<?php
5
6/* Use separate classes to make sure that in-place constant updates don't interfere */
7class A {
8    const object CONST1 = C;
9}
10class B {
11    const array CONST1 = C;
12}
13
14define("C", new stdClass());
15
16$rc = new ReflectionClassConstant(A::class, 'CONST1');
17var_dump($rc->getValue());
18echo $rc;
19
20$rc = new ReflectionClassConstant(B::class, 'CONST1');
21try {
22    $rc->getValue();
23} catch (TypeError $e) {
24    echo $e->getMessage() . "\n";
25}
26
27try {
28    echo $rc;
29} catch (TypeError $e) {
30    echo $e->getMessage() . "\n";
31}
32
33?>
34--EXPECT--
35object(stdClass)#1 (0) {
36}
37Constant [ public object CONST1 ] { Object }
38Cannot assign stdClass to class constant B::CONST1 of type array
39Cannot assign stdClass to class constant B::CONST1 of type array
40