Re: [RFC] Duration class
| From: | Tim Düsterhus | Date: | Fri, 03 Jul 2026 15:56:04 +0000 |
| Subject: | Re: [RFC] Duration class | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131736@lists.php.net to get a copy of this message | ||
Hi
On 7/1/26 04:27, Nick Sdot wrote:
This is a new OOP API, maybe we could prioritise DX over consistency
with bcdivmod()? Can we please return a value object like
"DurationDivision"?
divideInto() will be left to future scope, so let’s have that discussion then :-)
Nits:
- while not incorrect, I find Time for the namespace not ideal. As
others proposed, I'd also rather go with "Temporal".
I'll just refer to my previous email here: https://news-web.php.net/php.internals/131382
- in the "Proposal" section example of the RFC text the readonly are
redundantly on the class and properties; in the later example you only
have it on the properties.
Good catch, that was a mistake. I've adjusted the proof of concept implementation to add the readonly on the class. I've kept the redundant readonly on the properties to be extra explicit.
Best regards
Tim Düsterhus