fix: replace InvalidArgumentException -> ThisShouldNeverHappenException
This commit is contained in:
parent
a31b283847
commit
64667cc24c
@ -6,6 +6,7 @@ use App\Entity\DTO\QRCode\QRCode;
|
||||
use App\Entity\DTO\QRCode\QRCodeMoney;
|
||||
use App\Entity\DTO\QRCode\QRCodePaymentIdentification;
|
||||
use App\Entity\DTO\QRCode\QRCodeQROptions;
|
||||
use Nubium\Exception\ThisShouldNeverHappenException;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
final readonly class QRCodeEntityConverter
|
||||
@ -20,11 +21,11 @@ final readonly class QRCodeEntityConverter
|
||||
}
|
||||
|
||||
return new QRCode(
|
||||
$code->getIban() ?? throw new \InvalidArgumentException("iban not set"),
|
||||
\DateTimeImmutable::createFromMutable($code->getDueDate() ?? throw new \InvalidArgumentException("due date not set")),
|
||||
$code->getMessage() ?? throw new \InvalidArgumentException("message not set"),
|
||||
$this->convertMoney($code->getMoney() ?? throw new \InvalidArgumentException("money not set")),
|
||||
$this->convertCodeOptions($code->getCodeQROptions() ?? throw new \InvalidArgumentException("codeQROptions not set")),
|
||||
$code->getIban() ?? throw new ThisShouldNeverHappenException("iban not set"),
|
||||
\DateTimeImmutable::createFromMutable($code->getDueDate() ?? throw new ThisShouldNeverHappenException("due date not set")),
|
||||
$code->getMessage() ?? throw new ThisShouldNeverHappenException("message not set"),
|
||||
$this->convertMoney($code->getMoney() ?? throw new ThisShouldNeverHappenException("money not set")),
|
||||
$this->convertCodeOptions($code->getCodeQROptions() ?? throw new ThisShouldNeverHappenException("codeQROptions not set")),
|
||||
$this->convertIdentification($code->getPaymentIdentification())
|
||||
);
|
||||
}
|
||||
@ -32,8 +33,8 @@ final readonly class QRCodeEntityConverter
|
||||
protected function convertMoney(\App\Entity\Input\QRCode\QRCodeMoney $money): QRCodeMoney
|
||||
{
|
||||
return new QRCodeMoney(
|
||||
$money->getAmount() ?? throw new \InvalidArgumentException("amount not set"),
|
||||
$money->getCurrency() ?? throw new \InvalidArgumentException("currency not set")
|
||||
$money->getAmount() ?? throw new ThisShouldNeverHappenException("amount not set"),
|
||||
$money->getCurrency() ?? throw new ThisShouldNeverHappenException("currency not set")
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user