\PHP_INT_MAX || (\PHP_INT_SIZE === 8 && $value >= (float) \PHP_INT_MAX) ) { throw new \OverflowException('Progress byte count exceeds the maximum integer size supported on this platform'); } $intValue = (int) $value; if ($intValue < 0) { throw new \OverflowException('Progress byte count exceeds the maximum integer size supported on this platform'); } return $intValue; } public static function add(int $current, int $delta, string $message): int { if ($current < 0 || $delta < 0) { throw new \OverflowException($message); } if ($delta > \PHP_INT_MAX - $current) { throw new \OverflowException($message); } return $current + $delta; } }