@psalm-assert
The @psalm-assert tag asserts that an argument or variable is narrowed to a given type after the call returns. It is defined by the static analyzer Psalm.
"@psalm-assert" <Type> <Variable> [ <Description> ]
Parsing a @psalm-assert tag produces an AssertTag instance, carrying the asserted $type and $variable alongside the $name and optional $description every Tag already provides.
final class AssertTag extends TypedVariableTag {}
The same AssertTag is produced by @phpstan-assert and @phan-assert, which restate the same assertion for their respective tools.
See Psalm's supported annotations.
08 July 2026