3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface IRole { } interface Foo { public function bar(IRole $role = null); } class Bat implements Foo { public function bar(IRole $role) { echo "test"; } } $a = new Bat(); $a->bar();
based on kGjCH
Output for 7.1.0 - 7.2.0
Fatal error: Declaration of Bat::bar(IRole $role) must be compatible with Foo::bar(?IRole $role = NULL) in /in/5siQl on line 11
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Fatal error: Declaration of Bat::bar(IRole $role) must be compatible with Foo::bar(IRole $role = NULL) in /in/5siQl on line 11
Process exited with code 255.
Output for 5.4.0 - 5.6.26
Fatal error: Declaration of Bat::bar() must be compatible with Foo::bar(IRole $role = NULL) in /in/5siQl on line 11
Process exited with code 255.