1--TEST--
2Variance error in the presence of autoloading (1)
3--FILE--
4<?php
5
6spl_autoload_register(function($class) {
7    if ($class === 'A') {
8        class A {
9            public function method() : C {}
10        }
11    } else if ($class == 'B') {
12        class B extends A {
13            public function method() : B {}
14        }
15    } else {
16        class C extends B {
17        }
18    }
19});
20
21$b = new B;
22
23?>
24--EXPECTF--
25Fatal error: Declaration of B::method(): B must be compatible with A::method(): C in %s on line %d
26