3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class X { private $obj; function __construct(object $obj) { $this->obj = $obj; } function getObj(): object { return $this->object; } } $x = new X(new stdClass());
based on GDDRo
Output for 7.2.0 - 7.3.0beta1
Output for 7.0.0 - 7.1.20
Fatal error: Uncaught TypeError: Argument 1 passed to X::__construct() must be an instance of object, instance of stdClass given, called in /in/ffhIc on line 15 and defined in /in/ffhIc:6 Stack trace: #0 /in/ffhIc(15): X->__construct(Object(stdClass)) #1 {main} thrown in /in/ffhIc on line 6
Process exited with code 255.
Output for hhvm-3.22.0
Fatal error: Uncaught TypeError: Argument 1 passed to X::__construct() must be an instance of object, stdClass given in /in/ffhIc:-1 Stack trace: #0 /in/ffhIc(-1): X->__construct() #1 {main}
Process exited with code 255.
Output for hhvm-3.18.5 - 3.21.3
Fatal error: Uncaught TypeError: Argument 1 passed to X::__construct() must be an instance of object, stdClass given in /in/ffhIc:8 Stack trace: #0 /in/ffhIc(15): X->__construct() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/ffhIc on line 10
Process exited with code 255.