3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class HiddenUser { } class User { } class Foo { public function bar(User $u) {} } $foo = new Foo(); $user = new User(); $user = new HiddenUser(); $foo->bar($user);
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Argument 1 passed to Foo::bar() must be an instance of User, instance of HiddenUser given, called in /in/8HJQp on line 16 and defined in /in/8HJQp:10 Stack trace: #0 /in/8HJQp(16): Foo->bar(Object(HiddenUser)) #1 {main} thrown in /in/8HJQp on line 10
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Catchable fatal error: Argument 1 passed to Foo::bar() must be an instance of User, instance of HiddenUser given, called in /in/8HJQp on line 16 and defined in /in/8HJQp on line 10
Process exited with code 255.