1--TEST-- 2Typed class constants (inheritance success - object types) 3--FILE-- 4<?php 5class S implements Stringable { 6 public function __toString() { 7 return ""; 8 } 9} 10 11class Z extends S {} 12 13class A { 14 public const object CONST1 = S; 15 public const S CONST2 = S; 16 public const S|Stringable CONST3 = S; 17 public const S CONST4 = S; 18 public const ?S CONST5 = S; 19} 20 21class B extends A { 22 public const S CONST1 = Z; 23 public const Z CONST2 = Z; 24 public const S CONST3 = Z; 25 public const S&Stringable CONST4 = Z; 26 public const (S&Stringable)|null CONST5 = Z; 27} 28 29define("S", new S()); 30define("Z", new Z()); 31 32var_dump(B::CONST1); 33var_dump(B::CONST2); 34var_dump(B::CONST3); 35var_dump(B::CONST4); 36var_dump(B::CONST5); 37?> 38--EXPECTF-- 39object(Z)#%d (%d) { 40} 41object(Z)#%d (%d) { 42} 43object(Z)#%d (%d) { 44} 45object(Z)#%d (%d) { 46} 47object(Z)#%d (%d) { 48}