PHP TypeLang Help

@require-implements

Some traits are written against an interface rather than a concrete parent class — they call methods the interface guarantees, and only make sense mixed into a class that implements it. @require-implements declares that constraint, letting a static analyzer flag any class that uses the trait without also implementing the required interface.

"@require-implements" <Type> [ <Description> ]

Parsing a @require-implements tag produces a RequireImplementsTag instance exposing $type — the TypeNode naming the required interface — along with the inherited $name and $description.

abstract class RequireInheritanceTag extends TypedTag {} final class RequireImplementsTag extends RequireInheritanceTag { // inherits the computed TypeNode $type // getter from TypedTag; adds nothing. }

See also @require-extends for constraining a trait to classes extending a given parent class instead.

Neither PSR-19 nor phpDocumentor defines this tag. Its real-world spellings are vendor-prefixed: Psalm's @psalm-require-implements and PHPStan's @phpstan-require-implements (covered in PHPStan's PHPDoc basics). This component recognizes the bare @require-implements spelling shown above as the tool-agnostic equivalent of both.

05 July 2026