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

Use the BcMath\Number as new Type to work easier with arbitrary precision numbers #6644

Open
nio-dtp opened this issue Dec 8, 2024 · 2 comments · Fixed by #6686
Open

Use the BcMath\Number as new Type to work easier with arbitrary precision numbers #6644

nio-dtp opened this issue Dec 8, 2024 · 2 comments · Fixed by #6686

Comments

@nio-dtp
Copy link

nio-dtp commented Dec 8, 2024

Feature Request

What

Create a new Type to map a database column to the BcMath\Number class available since php 8.4

Why

The BcMath\Number class facilitates manipulation, calculations and comparisons between numbers. It would be nice to map a database column to this object. This way the developers could work directly with this new php object.

How

Create a new Type. It could use the sql declaration the DecimalType as it would share the same database mapping definition with precision and scale.

@derrabus
Copy link
Member

derrabus commented Jan 5, 2025

The new number class indeed looks like a good fit for the decimal type.

@derrabus
Copy link
Member

derrabus commented Jan 5, 2025

#6686

@derrabus derrabus linked a pull request Jan 5, 2025 that will close this issue
derrabus added a commit that referenced this issue Jan 6, 2025
|      Q       |   A
|------------- | -----------
| Type         | feature
| Fixed issues | #6644

#### Summary

PHP 8.4 introduces a new `Number` class
([RFC](https://wiki.php.net/rfc/support_object_type_in_bcmath),
php/php-src#13741) that feels like a perfect fit for `DECIMAL` values.
This PR introduces a new `NumberType` class and a corresponding
`Types::NUMBER` constant which maps decimal values to `Number` objects
instead of plain strings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants