3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class X {} class Y extends X {} class A { function f(): X {} } class B extends A { function f(): Y {} }
based on RSphf
Output for 7.0.0 - 7.0.2
Fatal error: Declaration of B::f(): Y must be compatible with A::f(): X in /in/LNO7Z on line 11
Process exited with code 255.
Output for 5.3.21 - 5.6.17
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/LNO7Z on line 7
Process exited with code 255.