Skip to content

Fix scale parameter check in bc math return type extension#353

Merged
ondrejmirtes merged 1 commit intophpstan:masterfrom
jaroslavlibal:master
Oct 21, 2020
Merged

Fix scale parameter check in bc math return type extension#353
ondrejmirtes merged 1 commit intophpstan:masterfrom
jaroslavlibal:master

Conversation

@jaroslavlibal
Copy link
Copy Markdown
Contributor

I believe that the "zero" check is incorrect for the third parameter.

There is a fallback to zero when the scale parametter is omitted and the default scale has not been set with the bcscale() function.

I added test cases covering the third parameter of the bcdiv and bcmod functions.

My changes should not break any of the existing tests. However, I would like to ask the extension author @eigan for a comment.

Problem example: https://phpstan.org/r/ef05165e-ca1e-4eb3-a26d-23d08c3d7b46

@eigan
Copy link
Copy Markdown
Contributor

eigan commented Oct 21, 2020

https://3v4l.org/DcrQh

Can't argue against that 😄

👍

@ondrejmirtes ondrejmirtes merged commit 609d703 into phpstan:master Oct 21, 2020
@ondrejmirtes
Copy link
Copy Markdown
Member

Perfect, 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.

3 participants