Re: [RFC] Duration class

From: Date: Sun, 21 Jun 2026 13:57:56 +0000
Subject: Re: [RFC] Duration class
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-131438@lists.php.net to get a copy of this message
Hi On 6/21/26 11:18, ignace nyamagana butera wrote:
Indeed Duration::divmod is the way forward just wondering about the return type. Should it be an array or a immutable DTO with .2 properties quotient and remainder?
For bcdivmod it was a deliberate choice to make the result a 2-tuple, with the expectation that array destructuring is used to consume the return value. Operation-wise I would agree that “div mod” is the correct thing to do, but I don't think that calling Duration/Duration->(int, Duration) literally divmod is an intuitive API when there's also the other division that does Duration/int->Duration. Best regards Tim Düsterhus

« previous php.internals (#131438) next »