Skip to content
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

Show issue for bitwise operations on floats #8362

Open
AndrolGenhald opened this issue Aug 3, 2022 · 3 comments
Open

Show issue for bitwise operations on floats #8362

AndrolGenhald opened this issue Aug 3, 2022 · 3 comments
Labels
easy problems Issues that can be fixed without background knowledge of Psalm enhancement good first issue Help wanted

Comments

@AndrolGenhald
Copy link
Collaborator

AndrolGenhald commented Aug 3, 2022

I could have sworn there was a PHP warning for doing bitwise operations on floats, but apparently not... Do we want to add an issue for that to Psalm?

Originally posted by @AndrolGenhald in #7992 (comment)

Apparently it is a warning, but only if the float isn't exactly an integer: https://3v4l.org/kWXWH

https://psalm.dev/r/42a6ae8735

@AndrolGenhald AndrolGenhald changed the title Add issue for bitwise operations on floats Show issue for bitwise operations on floats Aug 3, 2022
@AndrolGenhald AndrolGenhald added enhancement easy problems Issues that can be fixed without background knowledge of Psalm Help wanted good first issue labels Aug 3, 2022
@orklah
Copy link
Collaborator

orklah commented Aug 3, 2022

Yeah we could, possibly behind the strictBinaryOperands flag?

@AndrolGenhald
Copy link
Collaborator Author

AndrolGenhald commented Aug 3, 2022

Idk, since it's deprecated in PHP 8.1 I imagine it'll start being an error in some future version, whereas for strictBinaryOperands issues there's no PHP warning, it just automatically casts everything. Would you want to stick it behind strictBinaryOperands for PHP < 8.1 but have it always show for >= 8.1, or just have it always show for all versions independent of strictBinaryOperands?

@orklah
Copy link
Collaborator

orklah commented Aug 3, 2022

meh, too confusing, let's put it by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy problems Issues that can be fixed without background knowledge of Psalm enhancement good first issue Help wanted
Projects
None yet
Development

No branches or pull requests

2 participants