3v4l.org

run code in 200+ php & hhvm versions
<?php class A { public function foo($x): B { return new B; } } class B extends A { public function foo($x): C { return new C; } } class C extends B { } (new C)->foo('blah');
Output for 7.4.0alpha1 - 7.4.0beta4
Fatal error: Could not check compatibility between B::foo($x): C and A::foo($x): B, because class C is not available in /in/4bHiF on line 11
Process exited with code 255.
Output for 7.1.25 - 7.3.8
Fatal error: Declaration of B::foo($x): C must be compatible with A::foo($x): B in /in/4bHiF on line 14
Process exited with code 255.