1--TEST-- 2Typed class constants (type mismatch; runtime) 3--FILE-- 4<?php 5class A { 6 public const stdClass&Stringable CONST1 = C; 7} 8 9define("C", new stdClass); 10 11try { 12 var_dump(A::CONST1); 13} catch (TypeError $exception) { 14 echo $exception->getMessage() . "\n"; 15} 16 17try { 18 var_dump(A::CONST1); 19} catch (TypeError $exception) { 20 echo $exception->getMessage() . "\n"; 21} 22?> 23--EXPECT-- 24Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable 25Cannot assign stdClass to class constant A::CONST1 of type stdClass&Stringable 26