3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Container {} interface RuleSetInterface {} class RuleSet implements RuleSetInterface {} class Foo { public function __construct(Container $app, RuleSetInterface $rules) { $this->app = $app; var_dump(is_null($rules)); var_dump($rules instanceof RuleSetInterface); exit(); $this->rules = $rules; } } $foo = new Foo(new Container());
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Foo::__construct(), 1 passed in /in/vaqqK on line 22 and exactly 2 expected in /in/vaqqK:12 Stack trace: #0 /in/vaqqK(22): Foo->__construct(Object(Container)) #1 {main} thrown in /in/vaqqK on line 12
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Fatal error: Uncaught TypeError: Argument 2 passed to Foo::__construct() must implement interface RuleSetInterface, none given, called in /in/vaqqK on line 22 and defined in /in/vaqqK:12 Stack trace: #0 /in/vaqqK(22): Foo->__construct(Object(Container)) #1 {main} thrown in /in/vaqqK on line 12
Process exited with code 255.
Output for 5.3.21 - 5.6.28
Catchable fatal error: Argument 2 passed to Foo::__construct() must implement interface RuleSetInterface, none given, called in /in/vaqqK on line 22 and defined in /in/vaqqK on line 12
Process exited with code 255.