DivisionByZeroException.php
3 days ago
IntegerOverflowException.php
3 days ago
MathException.php
3 days ago
NegativeNumberException.php
3 days ago
NumberFormatException.php
3 days ago
RoundingNecessaryException.php
3 days ago
DivisionByZeroException.php
34 lines
| 1 | <?php |
| 2 | |
| 3 | declare (strict_types=1); |
| 4 | namespace IAWPSCOPED\Brick\Math\Exception; |
| 5 | |
| 6 | /** |
| 7 | * Exception thrown when a division by zero occurs. |
| 8 | * @internal |
| 9 | */ |
| 10 | class DivisionByZeroException extends MathException |
| 11 | { |
| 12 | /** |
| 13 | * @psalm-pure |
| 14 | */ |
| 15 | public static function divisionByZero() : DivisionByZeroException |
| 16 | { |
| 17 | return new self('Division by zero.'); |
| 18 | } |
| 19 | /** |
| 20 | * @psalm-pure |
| 21 | */ |
| 22 | public static function modulusMustNotBeZero() : DivisionByZeroException |
| 23 | { |
| 24 | return new self('The modulus must not be zero.'); |
| 25 | } |
| 26 | /** |
| 27 | * @psalm-pure |
| 28 | */ |
| 29 | public static function denominatorMustNotBeZero() : DivisionByZeroException |
| 30 | { |
| 31 | return new self('The denominator of a rational number cannot be zero.'); |
| 32 | } |
| 33 | } |
| 34 |