1--TEST-- 2Using ReflectionClass::__toString() with typed class constants when there is a type mismatch 3--FILE-- 4<?php 5 6class Foo { 7 const array CONST1 = C; 8} 9 10define("C", new stdClass()); 11 12try { 13 (string) new ReflectionClass(Foo::class); 14} catch (TypeError $e) { 15 echo $e->getMessage() . "\n"; 16} 17 18?> 19--EXPECT-- 20Cannot assign stdClass to class constant Foo::CONST1 of type array 21