3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class User {} interface UserGateway { function find($id): User; } class UserGateway_MySql implements UserGateway { // must return User or subtype of User function find($id) { return new User(); } } ?>
Output for 7.0.0 - 7.2.0
Fatal error: Declaration of UserGateway_MySql::find($id) must be compatible with UserGateway::find($id): User in /in/Wu6Fl on line 9
Process exited with code 255.
Output for 5.3.21 - 5.6.28
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/Wu6Fl on line 6
Process exited with code 255.