Skip to content

Tag reference

@param

The @param tag documents a single argument of a function or method: the type of value it accepts, and — since PHP’s own type hints cannot express everything a docblock can (a shape, a generic, a literal, a conditional type) — often more precisely than the function’s native signature does.

Grammar

"@param" <Type> <Variable> [ <Description> ]
"@phan-param" <Type> <Variable> [ <Description> ]
"@phpstan-param" <Type> <Variable> [ <Description> ]
"@psalm-param" <Type> <Variable> [ <Description> ]

Examples

A plain scalar type.
/**
* @param int $amount
*/
A generic collection type, with a description.
/**
* @param list<User> $recipients The people to notify.
*/
A shape describing the accepted array structure.
/**
* @param array{name: string, age: int<0, max>} $profile
*/

Names by platform

phan
@phan-param
phpstan
@phpstan-param
psalm
@psalm-param
standard
@param

The type is parsed using the full TypeLang grammar, so anything documented elsewhere in this reference — a shape, a generic, a conditional type — is equally valid here.

Parsing a @param tag produces a ParamTag instance exposing:

  • $type — the documented TypeNode.
  • $variable — the parameter’s name, without the leading $.
final class ParamTag extends TypedVariableTag
{
// Inherits `public readonly TypeNode $type` and
// `string $variable` from TypedVariableTag, plus
// `$name` and `$description` from the base `Tag`
// class; adds nothing of its own.
}

One @param tag is expected per documented argument, each naming the argument it describes; the order of the tags in the comment does not have to match the order of the arguments in the signature.

Defined by PSR-19 §5.10 — FIG’s proposed PHPDoc tags standard — and phpDocumentor’s own @param reference.