Skip to content

[12.x] brick/math of float deprecation#58563

Merged
taylorotwell merged 3 commits into
laravel:12.xfrom
jackbayliss:12-x-fix-BigNumber-of-deprecation
Jan 30, 2026
Merged

[12.x] brick/math of float deprecation#58563
taylorotwell merged 3 commits into
laravel:12.xfrom
jackbayliss:12-x-fix-BigNumber-of-deprecation

Conversation

@jackbayliss

@jackbayliss jackbayliss commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

Seeing this in CI, which is killing tests:

Passing floats to BigNumber::of() and arithmetic methods is deprecated and will be removed in 0.15. Cast the float to string explicitly to preserve the previous behaviour.

Passing float values to of() or arithmetic methods is deprecated in brick/math 0.14.2

This basically handles the float types and casts it to a string as suggested. All of the changes are basically within the ValidatesAttributes trait.

I don't think it's a B/C as it's just ensuring the current output / internal methods and all tests seem to pass.

Feel free to close / adjust as you see fit- figured I'd throw up a PR up as it was annoying me.

@github-actions

Copy link
Copy Markdown

Thanks for submitting a PR!

Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@jackbayliss

Copy link
Copy Markdown
Contributor Author

Only failing test here now is the static analysis one, which is addressed in #58562

Thanks!

@jackbayliss jackbayliss marked this pull request as ready for review January 30, 2026 21:38
@taylorotwell taylorotwell merged commit 4363327 into laravel:12.x Jan 30, 2026
71 of 72 checks passed
@jackbayliss jackbayliss deleted the 12-x-fix-BigNumber-of-deprecation branch January 30, 2026 22:38
@paweljar

paweljar commented Feb 5, 2026

Copy link
Copy Markdown

Did you forget about fixing the validateMin and validateMax rules? Both use BigNumber::of, which can get the float type and causes the warning.

@jackbayliss

Copy link
Copy Markdown
Contributor Author

@paweljar getSize is called inside the of() for both of those which shouldn't return a float hence the return type.

Unless there's some methods I missed? Or I'm missing something which is possible 😂

@paweljar

paweljar commented Feb 5, 2026

Copy link
Copy Markdown

@jackbayliss Thanks for the explanation! I see, and just double-checked it locally, the line below is the key and it fixes all other rules as well.

Clear, waiting for the release :)

image

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