DivisionByZeroException.php
2 days ago
IntegerOverflowException.php
2 days ago
MathException.php
2 days ago
NegativeNumberException.php
2 days ago
NumberFormatException.php
2 days ago
RoundingNecessaryException.php
2 days ago
IntegerOverflowException.php
22 lines
| 1 | <?php |
| 2 | |
| 3 | declare (strict_types=1); |
| 4 | namespace IAWPSCOPED\Brick\Math\Exception; |
| 5 | |
| 6 | use IAWPSCOPED\Brick\Math\BigInteger; |
| 7 | /** |
| 8 | * Exception thrown when an integer overflow occurs. |
| 9 | * @internal |
| 10 | */ |
| 11 | class IntegerOverflowException extends MathException |
| 12 | { |
| 13 | /** |
| 14 | * @psalm-pure |
| 15 | */ |
| 16 | public static function toIntOverflow(BigInteger $value) : IntegerOverflowException |
| 17 | { |
| 18 | $message = '%s is out of range %d to %d and cannot be represented as an integer.'; |
| 19 | return new self(\sprintf($message, (string) $value, \PHP_INT_MIN, \PHP_INT_MAX)); |
| 20 | } |
| 21 | } |
| 22 |