-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for int-mask and int-mask-of types #1166
Conversation
I'm not convinced 0 should be part of the union by default, but it's easy enough to add. Psalm does include it, so for parity it might be best to include it. |
Yeah, let's include |
src/PhpDoc/TypeNodeResolver.php
Outdated
|
||
if ($int !== 0) { | ||
foreach ($values as $value) { | ||
$values[] = $value | $int; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One idea for improvement. If the generated integer list is continuous, we could return IntegerRangeType instead.
Also please submit documentation for these types to https://phpstan.org/writing-php-code/phpdoc-types - there's a link to edit the page at the bottom. |
Perfect, thank you! Two ideas:
|
Great, thanks! |
Documentation for phpstan/phpstan-src#1166
Closes phpstan/phpstan#4732