run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); class Example { public function foo(int $f) { } } $e = new Example; $e->foo(null); //$e->foo(9); //$e->foo('string');
Output for 7.1.7
Fatal error: Uncaught TypeError: Argument 1 passed to Example::foo() must be of the type integer, null given, called in /in/PuVYb on line 13 and defined in /in/PuVYb:6 Stack trace: #0 /in/PuVYb(13): Example->foo(NULL) #1 {main} thrown in /in/PuVYb on line 6
Process exited with code 255.