Self and Parent Types
PHP allows using self and parent as return types.
Example
Section titled “Example”class Base {
public function create(): self { return new self(); }
}
class Child extends Base {
public function create(): parent { return parent::create(); }
}