-
-
Notifications
You must be signed in to change notification settings - Fork 501
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
Changes from all commits
7316a40
2694b0e
651f230
d02bb50
163767b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
"ramsey/collection": "^1.2 || ^2.0" | ||
}, | ||
"require-dev": { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
|
||
<projectFiles> | ||
<directory name="./src" /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,9 +136,11 @@ public function toInteger(Hexadecimal $value): IntegerObject | |
|
||
/** | ||
* Maps ramsey/uuid rounding modes to those used by brick/math | ||
* | ||
* @return BrickMathRounding::* | ||
*/ | ||
private function getBrickRoundingMode(int $roundingMode): int | ||
private function getBrickRoundingMode(int $roundingMode) | ||
{ | ||
return self::ROUNDING_MODE_MAP[$roundingMode] ?? 0; | ||
return self::ROUNDING_MODE_MAP[$roundingMode] ?? BrickMathRounding::UNNECESSARY; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
} | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.