Skip to content

Add numeric check on unary plus and unary minus#273

Merged
ondrejmirtes merged 1 commit intophpstan:2.0.xfrom
VincentLanglet:unaryCheck
Jul 21, 2025
Merged

Add numeric check on unary plus and unary minus#273
ondrejmirtes merged 1 commit intophpstan:2.0.xfrom
VincentLanglet:unaryCheck

Conversation

@VincentLanglet
Copy link
Copy Markdown
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
Copy Markdown
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