On Fri, Jun 19, 2026 at 7:15 PM Marc B. <[email protected]> wrote:

>
>
> Omg, I wrote in a wrong way - sorry.
> I mean the RFC just mentions "The Time\Duration class will also implement
> internal “comparison handlers”, which means that direct comparisons with
> operators such as < will work".
> So there are no other operators defined but there are methods defined for
> it. I would expect these defined as operators as well.
>
> Actually, for the division, there are two use cases but the method
> supports only one.
> 6s / 2 = 3s
> 6s / 2s = 3
>
>
 Hi Tim and Marc

I would go with two methods if possible :

Duration::countOf(Duration $duration): int;  // which would act a bit like
intdiv
Duration::remainder(Duration $duration): Duration;  // which would return
the remainder as a Duration instance

But that's just a thought.

Also why are there some restrictions on the factor argument of divideBy and
multiplyBy to only accept positive integers ?
At least that is what I understood when I quickly checked the proof of
concept. Since Duration are signed instances that restriction seems strange
?

Best regards,
Ignace

Reply via email to