3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface FooInterface { public function foo(FooInterface $foo); } class Bar implements FooInterface { public function foo(FooInterface $foo): FooInterface { return new self(); } } $bar = new Bar(); $result = $bar->foo(new Bar()); var_dump($result);
based on OpP23