@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> <Subject> [ <Description> ]
Parsing a @psalm-assert tag produces an AssertTag instance, carrying the asserted $type, the $subject it is asserted of and the $operator relating them, alongside the $name and optional $description every Tag already provides.
final class AssertTag extends AssertionTag {}
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.
12 September 2026