3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface MyInterface { public function doSomethingAndGetNextStep(): ?MyInterface; } class MyService implements MyInterface { public function doSomethingAndGetNextStep(): null { // do something here, like all other implementations // final one in chain return null; } } $a = new MyService(); var_dump($a->doSomethingAndGetNextStep());

preferences:
25.95 ms | 404 KiB | 5 Q