3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public function current() { } } class B {} class C extends A { public function current(): B { return new B(); } } $o = new C; var_dump($o->current());
based on LqqZD
Output for hhvm-3.18.5 - 3.22.0, 7.0.30 - 7.3.0alpha1
object(B)#2 (0) { }
Output for 5.6.30
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/h6ZP7 on line 13
Process exited with code 255.