PHP TypeLang Help

@method

The @method tag declares a "magic" method: one that a class makes callable through __call() or __callStatic() rather than through an ordinary method declaration, and that therefore does not otherwise appear anywhere in the class's own source. It is written on the class itself, once per magic method, using the same syntax as a callable type.

"@method" [ "static" ] [ <ReturnType> ] <CallableType> [ <Description> ]

Parsing a @method tag produces a MethodTag instance:

final class MethodTag extends Tag { public function __construct( string $name, public readonly CallableTypeNode $method, private readonly string $signature, public readonly bool $isStatic = false, ?DescriptionInterface $description = null, ) { parent::__construct($name, $description); } }

It exposes:

  • $method — the declared signature (its name, parameters and return type) as a CallableTypeNode.

  • $isStatic — whether the leading "static" keyword was present.

The constructor also keeps the signature exactly as written in a $signature property, but that one is private — it's not part of the tag's public shape, kept internally only so the tag can render itself back to source faithfully.

A return type written before the signature is folded into $method's own return type rather than kept separately, so both forms shown above end up producing the same $method value.

Defined by the PSR-19 draft and phpDocumentor's own page.

05 July 2026