Platforms
PHPStan tags
The PHPStan Tags are the annotations that belong to
PHPStan’s own vocabulary, written under its
@phpstan-* vendor prefix. As with Psalm, the prefix serves two roles: it
introduces PHPStan-specific features — assertions, its @phpstan-ignore
family of diagnostic suppressors, type aliases — and it provides a
PHPStan-scoped override of a tag that also exists unprefixed, letting a
project refine a type for PHPStan only.
A prefixed tag that mirrors one documented elsewhere — @phpstan-param
beside @param, @phpstan-return beside
@return — carries the same meaning as the plain spelling;
the prefix simply tells PHPStan to prefer this line when it and another tool
disagree.
What this group covers
Section titled “What this group covers”- Assertions — @phpstan-assert, @phpstan-assert-if-true, @phpstan-assert-if-false.
- Diagnostic suppression — the
@phpstan-ignorefamily (@phpstan-ignore, @phpstan-ignore-line, @phpstan-ignore-next-line). - Purity and immutability — @phpstan-pure, @phpstan-impure, @phpstan-immutable, @phpstan-readonly, @phpstan-pure-unless-callable-is-impure.
- Constructors and mutation — @phpstan-consistent-constructor, @phpstan-allow-private-mutation, @phpstan-readonly-allow-private-mutation.
- Generators — @phpstan-yield.
- Type aliases and generics — @phpstan-type, @phpstan-import-type, @phpstan-template (with its covariant and contravariant forms).
- Prefixed overrides — @phpstan-param, @phpstan-return, @phpstan-var, @phpstan-property, @phpstan-method, @phpstan-param-out, @phpstan-self-out, and the rest, each shadowing its unprefixed counterpart for PHPStan specifically.
For the authoritative definitions, see PHPStan’s PHPDoc reference.