Skip to content

Add numeric check on unary plus and unary minus #273

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

Merged
merged 1 commit into from
Jul 21, 2025

Conversation

VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented May 25, 2025

The operation $a + $b and $a - $b were checked but it was mising for the unary usage of these operators +$a or -$a.

Then, I plan to add such check for bitwise operators:

  • & (AND)
  • | (OR)
  • << (Left shift)
  • >> (Right shift)
  • ^ (XOR)

I assume it should be behind a new config option numericOperandsInBitwiseOperators @ondrejmirtes ?

@VincentLanglet VincentLanglet force-pushed the unaryCheck branch 3 times, most recently from dc350fa to b383425 Compare May 25, 2025 21:40
@ondrejmirtes ondrejmirtes merged commit f9f77ef into phpstan:2.0.x Jul 21, 2025
31 checks passed
@ondrejmirtes
Copy link
Member

Nice, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants