- Output for 7.1.25 - 7.1.31, 7.2.0 - 7.2.21, 7.3.0 - 7.3.8
- Fatal error: Declaration of B::foo(): ?Exception must be compatible with A::foo(): Exception in /in/i6uls on line 17
Process exited with code 255.
<?php
class A
{
public function foo(): Exception
{
return new Exception('foo');
}
}
class B extends A
{
public function foo(): ?Exception
{
return null;
}
}