3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict=1); class Test { } class A { public function abc(): Test { return null; } } $b = new A; print_r([ $b->abc() ]);
based on l19uC
Output for 7.0.0 - 7.2.0
Warning: Unsupported declare 'strict' in /in/OSW0E on line 2 Fatal error: Uncaught TypeError: Return value of A::abc() must be an instance of Test, null returned in /in/OSW0E:10 Stack trace: #0 /in/OSW0E(17): A->abc() #1 {main} thrown in /in/OSW0E on line 10
Process exited with code 255.
Output for 5.3.18 - 5.6.28
Warning: Unsupported declare 'strict' in /in/OSW0E on line 2 Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/OSW0E on line 9
Process exited with code 255.