- Output for 8.2.0 - 8.2.28, 8.3.0 - 8.3.22, 8.4.1 - 8.4.8
- Fatal error: Declaration of SomeChild::foo(): SomeChild must be compatible with SomeParent::foo(): static in /in/fmclK on line 13
Process exited with code 255.
<?php
class SomeParent
{
public function foo(): static
{
return $this;
}
}
final class SomeChild extends SomeParent
{
public function foo(): SomeChild
{
return $this;
}
}
var_dump((new SomeChild())->foo());