3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A {} class B extends A {} class C extends B {} class D {} interface InterfaceTest { public function foo(D $d); } abstract class AbstractTest { public abstract function foo(D $d); } class TestAbstractContravariance extends AbstractTest { public function foo($d) {} } class TestAbstractCovariance extends AbstractTest { public function foo($d) {} } class TestInterfaceContravariance implements InterfaceTest { public function foo($d) {} } class TestInterfaceCovariance implements InterfaceTest { public function foo($d) {} }
based on lgN55
Output for 5.4.2 - 5.6.13
Fatal error: Declaration of TestAbstractContravariance::foo() must be compatible with AbstractTest::foo(D $d) in /in/5faGB on line 15
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Fatal error: Declaration of TestAbstractContravariance::foo() must be compatible with that of AbstractTest::foo() in /in/5faGB on line 15
Process exited with code 255.