Post #4012822
2026-07-22 13:16 UTC
@timwolla@phpc.social I think I can improve it a bit more by not relying on is_int but on intdiv and PHP_INT_MAX instead
Replies (1)
-
@timwolla@phpc.social 2026-07-22 14:06
@nyamsprod@phpc.social `is_int()` is probably fine. The exception types are not quite correct, still: $seconds >= self::MAX_SECONDS must be a TimeException (overflow). $seconds = self::MAX_SECONDS, because `!is_int()` effectively means that $seconds >= self::MAX_SECONDS.