From 3608af3836bb11e19c37da0160a6174ff4758fb7 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Wed, 27 Aug 2025 15:51:36 +0300 Subject: [PATCH] currency value object support int --- application/Espo/Core/Field/Currency.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/application/Espo/Core/Field/Currency.php b/application/Espo/Core/Field/Currency.php index b5d733b10d..21e271b55b 100644 --- a/application/Espo/Core/Field/Currency.php +++ b/application/Espo/Core/Field/Currency.php @@ -44,13 +44,13 @@ class Currency private string $code; /** - * @param numeric-string|float $amount An amount. + * @param numeric-string|float|int $amount An amount. * @param string $code A currency code. * @throws RuntimeException */ public function __construct($amount, string $code) { - if (!is_string($amount) && !is_float($amount)) { + if (!is_string($amount) && !is_float($amount) && !is_int($amount)) { throw new InvalidArgumentException(); } @@ -58,7 +58,7 @@ class Currency throw new RuntimeException("Bad currency code."); } - if (is_float($amount)) { + if (is_float($amount) || is_int($amount)) { $amount = (string) $amount; } @@ -197,7 +197,7 @@ class Currency /** * Create from an amount and code. * - * @param numeric-string|float $amount An amount. + * @param numeric-string|float|int $amount An amount. * @param string $code A currency code. * @throws RuntimeException */