Hi

On 10/5/23 23:37, Jorg Sowa wrote:
I will also echo Tim's idea of using an enum instead and a union type.
For the namespace, I think it would make sense to use Maths\RoundingMode

Doesn't Math/Maths namespace introduce BC break?


Why do you think a namespace would introduce a BC break?

However I'd argue in favor of an enum, but within the global namespace. i.e. just \RoundingMode.

https://github.com/search?q=%22class+RoundingMode%22+language%3Aphp&type=code

only finds namespaced versions, so this should not be a break.

If you prefer not to introduce an enum, then you should at least add
PHP_ROUND_HALF_AWAY_FROM_ZERO as an alias for
PHP_ROUND_HALF_UP (and likewise for HALF_DOWN) to make the constants internally consistent.

Best regards
Tim Düsterhus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to