Platforms
Psalm tags
The Psalm Tags are the annotations that belong to
Psalm’s own vocabulary, written under its @psalm-*
vendor prefix. Psalm uses the prefix for two purposes: to introduce
capabilities the shared PHPDoc convention never had — taint tracking,
assertions, mutation freedom — and to offer a Psalm-scoped override of a tag
that also exists unprefixed, so that a project can tighten a type for Psalm
only without affecting other tools.
Where a Psalm tag is simply the prefixed twin of a tag already documented
elsewhere — @psalm-param beside @param,
@psalm-return beside @return — the two carry the same
meaning; the prefix only says “trust this spelling over the plain one when
Psalm is the analyzer reading it.”
What this group covers
Section titled “What this group covers”The tags here span Psalm’s full feature surface, including:
- Assertions — @psalm-assert, @psalm-assert-if-true, @psalm-assert-if-false, @psalm-assert-untainted.
- Immutability and purity — @psalm-immutable, @psalm-pure, @psalm-mutation-free, @psalm-external-mutation-free, @psalm-readonly.
- Taint analysis — @psalm-taint-source, @psalm-taint-sink, @psalm-taint-escape, @psalm-taint-specialize, and related flow tags.
- Type checks and context — @psalm-check-type, @psalm-check-type-exact, @psalm-if-this-is, @psalm-self-out, @psalm-scope-this, @psalm-trace, @psalm-variadic, @psalm-yield.
- Class design — @psalm-inheritors, @psalm-consistent-constructor, @psalm-consistent-templates, @psalm-no-seal-methods, @psalm-no-seal-properties, @psalm-allow-private-mutation, @psalm-readonly-allow-private-mutation, @psalm-override-method-visibility, @psalm-override-property-visibility, @psalm-stub-override.
- Ignoring nullable and falsable results — @psalm-ignore-nullable-return, @psalm-ignore-falsable-return, @psalm-ignore-var, @psalm-ignore-variable-method, @psalm-ignore-variable-property.
- Type aliases and generics — @psalm-type, @psalm-import-type, @psalm-template (with its covariant and contravariant forms).
- Prefixed overrides — @psalm-param, @psalm-return, @psalm-var, @psalm-property, @psalm-method, and the rest, each shadowing its unprefixed counterpart for Psalm specifically.
For the authoritative definitions, see Psalm’s supported annotations.