Post #4009064
2026-07-22 09:52 UTC
@nyamsprod@phpc.social Okay, the Overflow remark was ambiguous, I suppose:
- Negative inputs are a programmer error (thus ValueError) - for now at least.
- Out-of-range nanoseconds is also a programmer error.
The TimeException only applies to overflow of the entire range (i.e. an overflow in seconds).
I also suggest to test with `fromHours(PHP_INT_MAX)`. This will likely throw a TypeError internally, because of the int->double overflow. This should also be TimeException.
Replies (1)
-
@nyamsprod@phpc.social 2026-07-22 13:02
@timwolla@phpc.social ended up adding this small helper https://github.com/bakame-php/tokei/blob/main/lib/Time/Duration.php#L109-L115