self is a special keyword that refers to the class that the method was defined on

static is a special keyword that refers to the class that the method was called on


<?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);

?>