<?php
class A {
public function example() {
return new static;
}
}
class B extends A {
}
$b = new B();
$obj = $b->example();
// SaĆda:
// B
PD9waHAKCmNsYXNzIEEgewogICAgcHVibGljIGZ1bmN0aW9uIGV4YW1wbGUoKSB7CiAgICAgICAgcmV0dXJuIG5ldyBzdGF0aWM7CiAgICB9Cn0KCmNsYXNzIEIgZXh0ZW5kcyBBIHsKCn0KCiRiID0gbmV3IEIoKTsKJG9iaiA9ICRiLT5leGFtcGxlKCk7CgplY2hvIGdldF9jbGFzcygkb2JqKSwgUEhQX0VPTDsKCi8vIFNhw61kYToKLy8gQg==