PHP TypeLang Help

@extends

When a class extends a generic parent — one that declares its own @template type parameters — plain PHP inheritance has no way to say what those parameters resolve to in the subclass. @extends fills that gap by supplying the concrete (or still-generic) type arguments for the parent, so that a static analyzer can follow the type all the way down the hierarchy.

"@extends" <Type> [ <Description> ]

Parsing an @extends tag produces a tag exposing $type — the parsed TypeNode describing the parent with its type arguments — alongside the $name and $description every tag carries.

final class ExtendsTag extends TypedTag { // adds nothing of its own: $type is inherited // from TypedTag as a computed getter: // // public TypeNode $type { // get => $this->statement->type; // } // // backed by a protected TypeReference // $statement, which is not itself part // of the public shape. }

This component also registers two alternative spellings, @inherits and @template-extends, that some tools use in place of @extends; parsing either one produces the exact same kind of tag. See also @implements and @use for the equivalent tags on interfaces and traits.

@extends is not a phpDocumentor or PSR-19 tag. It is a generics convention introduced independently by PHPStan and Psalm, and this component follows their lead rather than any formal standard.

05 July 2026