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
25Warning: Uncaught Error: Class "Q" not found in %s:%d
26Stack trace:
27#0 %s(%d): {closure}('Y')
28#1 {main}
29  thrown in %s on line %d
30
31Fatal error: Could not check compatibility between B::method(): Y and A::method(): X, because class Y is not available in %s on line %d
32