3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Base {} class Sub extends Base{} class NoRelation {} abstract class I { abstract public function foo(Sub $x); } class CorrectImplementor extends I { public function foo(Base $x) {} // Should be ok } class IncorrectImplementor extends I { public function foo(NoRelation $x) {} // Should be disallowed }
Output for 7.0.0 - 7.0.2
Fatal error: Declaration of CorrectImplementor::foo(Base $x) must be compatible with I::foo(Sub $x) in /in/osXn2 on line 13
Process exited with code 255.
Output for 5.5.24 - 5.5.31, 5.6.8 - 5.6.17
Fatal error: Declaration of CorrectImplementor::foo() must be compatible with I::foo(Sub $x) in /in/osXn2 on line 13
Process exited with code 255.

preferences:
168.32 ms | 1395 KiB | 28 Q