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

Fix division without bcmath and using the precision parameter #19

Merged
merged 8 commits into from
Sep 30, 2021
Merged

Fix division without bcmath and using the precision parameter #19

merged 8 commits into from
Sep 30, 2021

Conversation

PierreRambaud
Copy link
Contributor

Questions Answers
Description? Introduce phpstan, github actions, php-cs-fixer and also fix a bug when using a precision without having bcmath set. Also update dependencies and increase the PHP requirement to PHP7.2+.
The actual fix about precision: 5d39d4e#diff-25c0e6754f8433ec8448cb2b71ba8d0a66b6574dcb8ed25e27a87eaf28c58996R115
Type? bug fix
BC breaks? no
Deprecations? no
How to test? Ci is green
Possible impacts? Please indicate what parts of the software we need to check to make sure everything is alright.

@matks
Copy link
Contributor

matks commented Sep 20, 2021

Introduce phpstan, github actions, php-cs-fixer and also fix a bug when using a precision without having bcmath set. Also update dependencies and increase the PHP requirement to PHP7.2+.

Maybe it would have been easier to submit different pull requests for each item 😛

@PierreRambaud PierreRambaud reopened this Sep 20, 2021
@PierreRambaud
Copy link
Contributor Author

Introduce phpstan, github actions, php-cs-fixer and also fix a bug when using a precision without having bcmath set. Also update dependencies and increase the PHP requirement to PHP7.2+.

Maybe it would have been easier to submit different pull requests for each item

No time, do you have time? The fix is a one line, and couldn't wait 3 years before being merge. Please rebase, review and merge fast!

matks
matks previously approved these changes Sep 20, 2021
Copy link
Contributor

@matks matks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

*/
public function testItThrowsExceptionIfRoundingModeIsInvalid()
{
$this->expectException(InvalidArgumentException::class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I prefer assertions rather than phpDoc magic annotation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The magic annotation has been deprecated and no longer work in the next release, that's the reason ^^

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the latest trends always

excludes_analyse:
- vendor/
reportUnmatchedIgnoredErrors: false
level: max
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

$result = $this->integerDivision($a, $b, max($precision, $aPrecision));

return $result;
return $this->integerDivision($a, $b, $precision);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the current implementation

  • if $aPrecision > $precision it uses $aPrecision although $precision have been requested by user
  • if $bPrecision > $aPrecision it uses $aPrecision

I agree your code seems more valid.

@matks
Copy link
Contributor

matks commented Sep 20, 2021

Introduce phpstan, github actions, php-cs-fixer and also fix a bug when using a precision without having bcmath set. Also update dependencies and increase the PHP requirement to PHP7.2+.

Maybe it would have been easier to submit different pull requests for each item

No time, do you have time? The fix is a one line, and couldn't wait 3 years before being merge. Please rebase, review and merge fast!

Do I even know php?

@PierreRambaud
Copy link
Contributor Author

Introduce phpstan, github actions, php-cs-fixer and also fix a bug when using a precision without having bcmath set. Also update dependencies and increase the PHP requirement to PHP7.2+.

Maybe it would have been easier to submit different pull requests for each item

No time, do you have time? The fix is a one line, and couldn't wait 3 years before being merge. Please rebase, review and merge fast!

Do I even know php?

Who need to know something someone already know better than you need to know! 👀

Copy link
Member

@Progi1984 Progi1984 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you add all Github Actions ? All have already done in develop

@PierreRambaud PierreRambaud changed the base branch from master to develop September 21, 2021 09:52
Progi1984
Progi1984 previously approved these changes Sep 21, 2021
@Progi1984 Progi1984 requested a review from matks September 21, 2021 10:09
composer.json Outdated Show resolved Hide resolved
matks
matks previously approved these changes Sep 21, 2021
@PierreRambaud PierreRambaud dismissed stale reviews from matks and Progi1984 via b1dd00a September 21, 2021 13:29
@matks
Copy link
Contributor

matks commented Sep 23, 2021

I approve the PR and CI is green. We could merge or maybe ask for another review from @PrestaShop/prestashop-maintainers

@atomiix atomiix merged commit 9140339 into PrestaShop:develop Sep 30, 2021
@atomiix
Copy link
Contributor

atomiix commented Sep 30, 2021

Thanks @PierreRambaud

@PierreRambaud PierreRambaud deleted the fix/without-bcmath branch January 6, 2022 08:16
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.

4 participants