Fix BcMath\Number increment/decrement#4957
Conversation
|
You've opened the pull request against the latest branch 2.2.x. PHPStan 2.2 is not going to be released for months. If your code is relevant on 2.1.x and you want it to be released sooner, please rebase your pull request and change its target to 2.1.x. |
eded554 to
c369be5
Compare
VincentLanglet
left a comment
There was a problem hiding this comment.
You need to target 2.1.x
c369be5 to
a5fac39
Compare
|
Rebased and targeted to |
|
Hmm.. I wanted to make sure that we report errors on PHP < 8.4 when the polyfill is installed, but looks like the test doesn't report any errors. |
85fd9f3 to
5f4370d
Compare
|
Please take a new look @staabm with the changes |
|
I like the PR so far. per https://www.php.net/manual/en/class.bcmath-number.php
this class also has special comparison semantics. I think it would make sense to cover both aspects in this PR. |
Isn't already handled by ? |
5f4370d to
4e25325
Compare
|
you are right. its covered in tests/PHPStan/Analyser/nsrt/bcmath-number.php |
|
thank you @mpesari |
| #[RequiresPhp('>= 8.4')] | ||
| public function testBcMathNumber(): void | ||
| { | ||
| $this->analyse([__DIR__ . '/data/inc-dec-bcmath-number.php'], []); |
There was a problem hiding this comment.
Would be nice to run this before 8.4 too, and set the expected errors.
There was a problem hiding this comment.
According to the author, the test was reporting no error for version before 8.4 (cf #4957 (comment))
Looking at the playground https://phpstan.org/r/bf941228-962c-42af-a859-b909918634a7, I assume that the type is "ERROR" and no error is reported when doing increment/decrement on ErrorType.
So I thought this wasn't a relevant test to add
There was a problem hiding this comment.
Oh it's a new class. I get it, thanks.
There was a problem hiding this comment.
BTW in that playground enabling strict-rules shows more errors. I'll take a look tomorrow.
Partial fix for phpstan/phpstan#13965
This adds support for BcMath\Number increment/decrement operations on PHP >= 8.4.