-
Notifications
You must be signed in to change notification settings - Fork 506
Implement bit shift operation on integers and unions #3145
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
Conversation
d882aa9
to
db47c34
Compare
This pull request has been marked as ready for review. |
@ondrejmirtes I played with this feature for a few days in my codebase and I feel it is ready to go. Can you review this? Is there anythink that I'm overlooking? |
@@ -1468,9 +1469,6 @@ private function callOperatorTypeSpecifyingExtensions(Expr\BinaryOp $expr, Type | |||
return null; | |||
} | |||
|
|||
/** | |||
* @param BinaryOp\Plus|BinaryOp\Minus|BinaryOp\Mul|BinaryOp\Div $expr |
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.
Please add ShiftLeft and ShiftRight here, instead of removing the PHPDoc.
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.
Done for both. This should lead to a unreachable statement for the "else" branch, not sure if that is a problem.
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.
This should lead to
It doesn't in bleeding edge. PHPStan no longer penalizes for unreachable else branch that throws an exception.
@@ -1560,7 +1561,6 @@ private function resolveCommonMath(Expr\BinaryOp $expr, Type $leftType, Type $ri | |||
|
|||
/** | |||
* @param ConstantIntegerType|IntegerRangeType $range | |||
* @param BinaryOp\Div|BinaryOp\Minus|BinaryOp\Mul|BinaryOp\Plus $node |
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.
Please add ShiftLeft and ShiftRight here, instead of removing the PHPDoc.
Please note that this would conflict with #3152 if it gets merged. That should have the priority as I think it's a bad bug. I'm happy to rebase this (or the other) in case. |
36171c3
to
a42834d
Compare
Thank you. |
This was in my wishlist for a long time.. so I did it 😄