Re: [PHP-DEV] Re: [RFC] [Discussion] Add 4 new rounding modes to round() function
Thank you for your comments. Listening to the opinions I will not include deprecation of the constants and introducing the RoundingMode enum in this RFC. Sorry for the delay. I will start eventually voting on the RFC tomorrow. Kind regards, Jorg
Re: [PHP-DEV] Re: [RFC] [Discussion] Add 4 new rounding modes to round() function
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=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
Re: [PHP-DEV] Re: [RFC] [Discussion] Add 4 new rounding modes to round() function
> I don't think deprecating the constants in the version where the aliases are introduced is a good idea. I removed the deprecation. You are right. > 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? Kind regards, Jorg
Re: [PHP-DEV] Re: [RFC] [Discussion] Add 4 new rounding modes to round() function
On Wed, 4 Oct 2023 at 23:23, Jorg Sowa wrote: > Thank you all for the discussion. I modified description of the RFC and > added deprecation of constants ROUND_UP and ROUND_DOWN from Intl extension > as an additional voting. > > Thanks also for input about possible mode ROUND_STOCHASTIC, however I think > it's the idea for the extension and not the addition to the standard > functions. > > I would like to start the voting in coming days. > I don't think deprecating the constants in the version where the aliases are introduced is a good idea. There needs to be at least one version where both variants exist to allow for cross version compatibility. 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 Best regards, George P. Banyard
[PHP-DEV] Re: [RFC] [Discussion] Add 4 new rounding modes to round() function
Thank you all for the discussion. I modified description of the RFC and added deprecation of constants ROUND_UP and ROUND_DOWN from Intl extension as an additional voting. Thanks also for input about possible mode ROUND_STOCHASTIC, however I think it's the idea for the extension and not the addition to the standard functions. I would like to start the voting in coming days. Kind regards, Jorg