allow vendord
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s

This commit is contained in:
2026-03-30 14:54:57 +07:00
parent 66aed7c4e8
commit b5e3a778ce
21316 changed files with 2777892 additions and 13 deletions

View File

@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);
namespace Money\Exception;
final class CurrencyMismatchException extends InvalidArgumentException
{
}

View File

@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);
namespace Money\Exception;
final class DivisionByZeroException extends InvalidArgumentException
{
}

View File

@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace Money\Exception;
use Money\Exception;
use RuntimeException;
/**
* Thrown when a Money object cannot be formatted into a string.
*/
final class FormatterException extends RuntimeException implements Exception
{
}

View File

@@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace Money\Exception;
use InvalidArgumentException as CoreInvalidArgumentException;
use Money\Exception;
/**
* @internal
*/
class InvalidArgumentException extends CoreInvalidArgumentException implements Exception
{
/** @phpstan-pure */
public static function divisionByZero(): DivisionByZeroException
{
return new DivisionByZeroException('Cannot compute division with a zero divisor');
}
/** @phpstan-pure */
public static function moduloByZero(): ModuloByZeroException
{
return new ModuloByZeroException('Cannot compute modulo with a zero divisor');
}
/** @phpstan-pure */
public static function currencyMismatch(): CurrencyMismatchException
{
return new CurrencyMismatchException('Currencies must be identical');
}
}

View File

@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);
namespace Money\Exception;
final class ModuloByZeroException extends InvalidArgumentException
{
}

View File

@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace Money\Exception;
use Money\Exception;
use RuntimeException;
/**
* Thrown when a string cannot be parsed to a Money object.
*/
final class ParserException extends RuntimeException implements Exception
{
}

View File

@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace Money\Exception;
use DomainException;
use Money\Exception;
/**
* Thrown when trying to get ISO currency that does not exists.
*/
final class UnknownCurrencyException extends DomainException implements Exception
{
}

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace Money\Exception;
use InvalidArgumentException;
use Money\Currency;
use Money\Exception;
use function sprintf;
/**
* Thrown when there is no currency pair (rate) available for the given currencies.
*/
final class UnresolvableCurrencyPairException extends InvalidArgumentException implements Exception
{
/**
* Creates an exception from Currency objects.
*/
public static function createFromCurrencies(Currency $baseCurrency, Currency $counterCurrency): UnresolvableCurrencyPairException
{
$message = sprintf(
'Cannot resolve a currency pair for currencies: %s/%s',
$baseCurrency->getCode(),
$counterCurrency->getCode()
);
return new self($message);
}
}