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