- Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
- object(SomeChild)#1 (0) { }
<?php
class SomeParent
{
public function foo(): self
{
return $this;
}
}
final class SomeChild extends SomeParent
{
public function foo(): SomeChild
{
return $this;
}
}
var_dump((new SomeChild())->foo());