Tag reference
@assert-if-true
The @assert-if-true tag asserts the given type for a subject, but only when the function returns true.
Grammar
"@phan-assert-if-true" [ ( "!=" | "!" | "=" ) ] <Type> <AssertSubject> [ <Description> ]"@phpstan-assert-if-true" [ ( "!=" | "!" | "=" ) ] <Type> <AssertSubject> [ <Description> ]"@psalm-assert-if-true" [ ( "!=" | "!" | "=" ) ] <Type> <AssertSubject> [ <Description> ]Examples
/** * @phan-assert-if-true string $value */function isString(mixed $value): bool/** * @phpstan-assert-if-true int $value */function isInteger(mixed $value): bool/** * @psalm-assert-if-true array<string, mixed> $value */function isMap(mixed $value): boolNames by platform
- phan
@phan-assert-if-true- phpstan
@phpstan-assert-if-true- psalm
@psalm-assert-if-true