- var_dump: documentation ( source)
<?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());