Skip to content

Commit

Permalink
Add documentation for int masks
Browse files Browse the repository at this point in the history
Documentation for phpstan/phpstan-src#1166
  • Loading branch information
rvanvelzen authored and ondrejmirtes committed Apr 26, 2022
1 parent 4494b64 commit 14e62f6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions website/src/writing-php-code/phpdoc-types.md
Expand Up @@ -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
-------------------------

<div class="text-xs inline-block border border-green-600 text-green-600 bg-green-100 rounded px-1 mb-4">Available in PHPStan 1.6</div>

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<Foo::INT_*>` (accepts values from all constants on `Foo` that start with `INT_`)

0 comments on commit 14e62f6

Please sign in to comment.