3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class C { function foo(T $t) {} } $c = new C; $c->foo($c);
based on bY9H2
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Argument 1 passed to C::foo() must be an instance of T, instance of C given, called in /in/IBmft on line 8 and defined in /in/IBmft:4 Stack trace: #0 /in/IBmft(8): C->foo(Object(C)) #1 {main} thrown in /in/IBmft on line 4
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Catchable fatal error: Argument 1 passed to C::foo() must be an instance of T, instance of C given, called in /in/IBmft on line 8 and defined in /in/IBmft on line 4
Process exited with code 255.