vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.55k stars 659 forks source link

`InvalidDocblock` while using constants with `int-mask-of<>` #8311

Open fluffycondor opened 2 years ago

fluffycondor commented 2 years ago

https://psalm.dev/r/348f362bc8

PHPStan considers this snippet perfectly valid: https://phpstan.org/r/b6a8fe7d-df8a-459b-b1a1-46be219287cc

psalm-github-bot[bot] commented 2 years ago

I found these snippets:

https://psalm.dev/r/348f362bc8 ```php $options */ public function foo(int $options): void {} } ``` ``` Psalm output (using commit f6fb715): ERROR: InvalidDocblock - 10:15 - Union types are not allowed in value-of type in docblock for Foo::foo ```
AndrolGenhald commented 2 years ago

You can do this instead.

psalm-github-bot[bot] commented 2 years ago

I found these snippets:

https://psalm.dev/r/ac5b1559a4 ```php $options */ public function foo(int $options): void {} } ``` ``` Psalm output (using commit f6fb715): No issues! ```