1--TEST-- 2Exception during delayed variance autoload 3--FILE-- 4<?php 5spl_autoload_register(function($class) { 6 echo "$class\n"; 7 if ($class == 'X') { 8 new Y; 9 } 10 if ($class == 'Y') { 11 new Q; 12 } 13}); 14class A { 15 function method(): X {} 16} 17class B extends A { 18 function method(): Y {} 19} 20?> 21--EXPECTF-- 22Y 23Q 24 25Fatal error: During inheritance of B, while autoloading Y: Uncaught Error: Class "Q" not found in %s:%d 26Stack trace: 27#0 %s(%d): {closure}('Y') 28#1 {main} in %s on line %d 29