@phan-assert-if-true
The @phan-assert-if-true tag asserts the given type for an argument or variable when the function returns true. It belongs to the same assertion family as @phan-assert and its counterpart @phan-assert-if-false.
"@phan-assert-if-true" <Type> <Variable> [ <Description> ]
Parsing a @phan-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 @psalm-assert-if-true and @phpstan-assert-if-true, which restate the same assertion for their respective tools.
Defined by Phan; see the "Assertions" section of Phan's Annotating Your Source Code wiki.
08 July 2026