- Output for 8.2.10 - 8.2.29, 8.3.5 - 8.3.25, 8.4.1 - 8.4.12
- NULL
- Output for 8.1.23 - 8.1.33
- Fatal error: Null can not be used as a standalone type in /in/4oW9v on line 10
Process exited with code 255.
<?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());