From ca31931a53d5f7db2fe667aa5b14b6fd57292803 Mon Sep 17 00:00:00 2001 From: Ruud Kamphuis Date: Sun, 29 Dec 2019 15:22:09 +0100 Subject: [PATCH] Explain bool assertions (#2528) --- docs/annotating_code/assertion_syntax.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/annotating_code/assertion_syntax.md b/docs/annotating_code/assertion_syntax.md index f7826ec42..b67bb3e7d 100644 --- a/docs/annotating_code/assertion_syntax.md +++ b/docs/annotating_code/assertion_syntax.md @@ -64,6 +64,18 @@ This asserts that `$bar` is not an object of type `SomeObjectType`: /** @psalm-assert !SomeObjectType $bar */ ``` +## Bool assertions + +This asserts that `$bar` is `true`: +```php +/** @psalm-assert true $bar */ +``` + +This asserts that `$bar` is not `false`: +```php +/** @psalm-assert !false $bar */ +``` + ## Equality assertions Psalm also supports the equivalent of `assert($some_int === $other_int)` in the form