1--TEST-- 2Lazy objects: Class constants are updated before initialization: update constant failure 3--FILE-- 4<?php 5 6class C { 7 public C $a = FOO; 8} 9 10$reflector = new ReflectionClass(C::class); 11$c = $reflector->newLazyGhost(function () { }); 12 13function f() { 14 define('FOO', new stdClass); 15} 16 17f(); 18 19try { 20 var_dump($c->a); 21} catch (\Error $e) { 22 printf("%s: %s\n", $e::class, $e->getMessage()); 23} 24 25--EXPECT-- 26TypeError: Cannot assign stdClass to property C::$a of type C 27