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