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

feat: Support brick/math v0.12 #526

Merged
merged 5 commits into from
Apr 27, 2024
Merged

Conversation

siketyan
Copy link
Contributor

Closes #525

Description

This pull request adds support for brick/math v0.12.

Motivation and context

brick/math v0.12 has been released.
ramsey/uuid requires < 0.12 for now, so we can not upgrade brick/math until ramsey/uuid supports it.

How has this been tested?

Static Analysis + Unit Tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

PR checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING.md document.
  • I have added tests to cover my changes.

Comment on lines +82 to +87
include:
# Keep the locked version by default
- dependency-versions: "locked"
# For PHP 8.0, installing with --prefer-highest to use brick/math v0.11
- php-version: "8.0"
dependency-versions: "highest"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since brick/math is now locked at v0.12.1 (which requires PHP >= 8.1) in composer.lock, CI can not install it on PHP 8.0. Using --prefer-highest to avoid the version and use v0.11. Let me know if there is much better solution.

Copy link

Choose a reason for hiding this comment

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

maybe drop support for PHP 8.0

https://www.php.net/supported-versions.php

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, PHP 8.0 is now EOL so we can remove the support.
Let @ramsey decide anyway.

@@ -11,7 +11,7 @@
"require": {
"php": "^8.0",
"ext-json": "*",
"brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11",
"brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI: I tried installing brick/math with --prefer-lowest and run a static analysis, but it failed since BigInteger::toBytes does not exist in v0.8.8. This is out of scope for this PR, so I ignored.

@@ -4,7 +4,8 @@
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorLevel="1"
cacheDirectory="./build/cache/psalm"
errorBaseline="psalm-baseline.xml">
errorBaseline="psalm-baseline.xml"
phpVersion="8.1">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Psalm infers the target PHP version from composer.json by default. Enum classes add in brick/math v0.12 are ignored in PHP 8.0, so fixed to PHP 8.1 as the target to avoid it.

{
return self::ROUNDING_MODE_MAP[$roundingMode] ?? 0;
return self::ROUNDING_MODE_MAP[$roundingMode] ?? BrickMathRounding::UNNECESSARY;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

BrickMathRounding::* is a enum case in v0.12 and is a const value in v0.11.

@MartinMystikJonas
Copy link

This issue blocks our upgrade because we use another package requiring brick/math 0.12+. Is there anything I can do to help to make this merged?

@ramsey
Copy link
Owner

ramsey commented Jan 17, 2024

Sorry for the delay. I've been dealing with some rough issues in my personal life, most notably, I'm unemployed at the moment, so every waking hour is spent job-searching, and I haven't had time for open source contributions. I will try to revisit this and merge and release it as soon as I can, but it might still be a while. Thank you for your patience!

@nijholt
Copy link

nijholt commented Jan 31, 2024

@ramsey any updates on this issue?

@betterthanclay
Copy link

Hi @ramsey - hope all is well with you. Is there anything we can do to help get this one over the line? It's a showstopper for multiple projects for me that need to be using Brick/Money which requires Brick/Math 0.12+. Thanks!

@emielmolenaar
Copy link

@ramsey Hope you are doing well. Hoping to merge this one soon. If there is anything we can do, let us know. Thank you.

Copy link

codecov bot commented Apr 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.64%. Comparing base (d459bdb) to head (163767b).
Report is 15 commits behind head on 4.x.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##                4.x     #526   +/-   ##
=========================================
  Coverage     95.64%   95.64%           
  Complexity      583      583           
=========================================
  Files            70       70           
  Lines          1560     1560           
=========================================
  Hits           1492     1492           
  Misses           68       68           
Files Coverage Δ
src/Math/BrickMathCalculator.php 100.00% <100.00%> (ø)

@ramsey
Copy link
Owner

ramsey commented Apr 27, 2024

Thank you for contributing! 🎉

@ramsey ramsey merged commit 3caf795 into ramsey:4.x Apr 27, 2024
18 checks passed
@siketyan siketyan deleted the feat/brick-math-0.12 branch April 28, 2024 05:09
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.

Update brick/math to support v0.12.0
7 participants