Skip to content

Tag reference

@psalm-inheritors

The @psalm-inheritors tag restricts which classes are allowed to extend or implement the described type, letting Psalm flag any subclass or implementation outside the listed set.

Grammar

"@psalm-inheritors" <Type> [ <Description> ]

Examples

The only classes that may extend the type.
/**
* @psalm-inheritors Circle|Square
*/
abstract class Shape {}

Names by platform

psalm
@psalm-inheritors

Parsing a @psalm-inheritors tag produces a PsalmInheritorsTag instance, carrying the parsed $type alongside the $name and optional $description every Tag already provides.

final class PsalmInheritorsTag extends TypedTag {}

Defined by Psalm’s supported annotations reference.