<?php
class Article
{
private function __construct(private string $title) {}
static function createWithTitle(string $title) : *static* {
return new *static*("A: {$title}");
}
}
class Document extends Article
{
}
$a = Article::createWithTitle('Article');
$d = Document::createWithTitle('Document');
var_dump($a, $d);
?>