From 14e62f6f813d9cc6019086500d938232f5eae5ab Mon Sep 17 00:00:00 2001 From: Richard van Velzen Date: Mon, 4 Apr 2022 10:47:23 +0200 Subject: [PATCH] Add documentation for int masks Documentation for phpstan/phpstan-src#1166 --- website/src/writing-php-code/phpdoc-types.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/website/src/writing-php-code/phpdoc-types.md b/website/src/writing-php-code/phpdoc-types.md index 93311b30bd..c8a9c343b9 100644 --- a/website/src/writing-php-code/phpdoc-types.md +++ b/website/src/writing-php-code/phpdoc-types.md @@ -327,3 +327,14 @@ All of these names are equivalent: * `no-return` Marking a function or a method as `@return never` tells PHPStan the function always throws an exception, or contains a way to end the script execution, like `die()` or `exit()`. This is useful when [solving undefined variables](/writing-php-code/solving-undefined-variables). + +Int masks +------------------------- + +
Available in PHPStan 1.6
+ +Some functions accept a bitmask composed by `|`-ing different integer values. `0` is always part of the possible values. Some examples: + +* `int-mask<1, 2, 4>` (accepts values that can be composed using `|` from the given integers, and 0) +* `int-mask-of<1|2|4>` (the same as above, but writting as a union) +* `int-mask-of` (accepts values from all constants on `Foo` that start with `INT_`)