3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class X {} class Y extends X {} interface InterfaceA { function beMyself(X $a);//: self; } class ClassA implements InterfaceA { function beMyself(Y $a) //: self { return $this; } } var_dump((new ClassA)->beMyself());
Output for 7.0.0 - 7.2.0
Fatal error: Declaration of ClassA::beMyself(Y $a) must be compatible with InterfaceA::beMyself(X $a) in /in/6sk1i on line 12
Process exited with code 255.
Output for 5.4.10 - 5.6.28
Fatal error: Declaration of ClassA::beMyself() must be compatible with InterfaceA::beMyself(X $a) in /in/6sk1i on line 13
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/6sk1i on line 20
Process exited with code 255.