Re: [PHP-DEV] [RFC] Duration class
[email protected] (Tim Düsterhus)
| Newsgroups | php.internals |
|---|---|
| Message-ID | <[email protected]> |
Hi On 6/29/26 19:42, Tim Düsterhus wrote: > Thank you for providing that example. The restriction was primarily > added as a safety: Removing restrictions later is always possible, > adding them is not. So absent a good use-case choosing the “error” > option is safer. Given you have provided an example, it makes sense to > me to lift the restriction. > > For the `fromSeconds()` constructor it's not completely obvious how to > handle negative values there (see the discussion with Marc). I think > requiring both parameters to have the same sign would be the correct > solution here, since this will provide for an intuitive representation > of magnitude (see also below). What do you think? > > I'll also discuss this with Derick before adjusting the RFC. I have now discussed this with Derick. He said that he would prefer keeping the restriction for now, particularly since the `fromSeconds()` constructor is not totally obvious. But as mentioned in my previous email, this is something we can revisit later, for example when adding the “Future Scope” classes, before that happens, negative Durations are not particularly useful anyways. Given the small remaining time until the freeze, I'm going to “close out” this thread, but it will definitely serve as a useful reference in the future. Thanks again! Best regards Tim Düsterhus