From 10e12ecd3b8dde4987e6e90cacf06bd52eebd9c3 Mon Sep 17 00:00:00 2001 From: Johan Wilfer Date: Tue, 21 Nov 2023 16:47:20 +0100 Subject: [PATCH 1/2] Use the Doctrine native column types (int) --- src/Entity/DoctrineStorageRatio.php | 2 +- src/Entity/RatioHistory.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Entity/DoctrineStorageRatio.php b/src/Entity/DoctrineStorageRatio.php index afa02752..2e1bb5e7 100644 --- a/src/Entity/DoctrineStorageRatio.php +++ b/src/Entity/DoctrineStorageRatio.php @@ -9,7 +9,7 @@ */ class DoctrineStorageRatio { - private mixed $id = null; + private ?int $id = null; public function __construct(private ?string $currencyCode = null, private ?float $ratio = null) { diff --git a/src/Entity/RatioHistory.php b/src/Entity/RatioHistory.php index e797a412..7dcd447c 100644 --- a/src/Entity/RatioHistory.php +++ b/src/Entity/RatioHistory.php @@ -12,7 +12,7 @@ */ class RatioHistory { - protected mixed $id = null; + protected ?int $id = null; protected string $referenceCurrencyCode = ''; protected string $currencyCode = ''; protected float $ratio = 0; From 84ad71d54624b68f6f6d15a77ce7a6bef7fc09f5 Mon Sep 17 00:00:00 2001 From: Johan Wilfer Date: Wed, 22 Nov 2023 17:05:14 +0100 Subject: [PATCH 2/2] Correct types in getters/setters as well and small cleanup --- src/Entity/DoctrineStorageRatio.php | 11 +++++------ src/Entity/RatioHistory.php | 7 ++----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/Entity/DoctrineStorageRatio.php b/src/Entity/DoctrineStorageRatio.php index 2e1bb5e7..86c37bfa 100644 --- a/src/Entity/DoctrineStorageRatio.php +++ b/src/Entity/DoctrineStorageRatio.php @@ -4,18 +4,17 @@ namespace Tbbc\MoneyBundle\Entity; -/** - * Class DoctrineStorageRatio. - */ class DoctrineStorageRatio { private ?int $id = null; - public function __construct(private ?string $currencyCode = null, private ?float $ratio = null) - { + public function __construct( + private ?string $currencyCode = null, + private ?float $ratio = null, + ) { } - public function getId(): mixed + public function getId(): int { return $this->id; } diff --git a/src/Entity/RatioHistory.php b/src/Entity/RatioHistory.php index 7dcd447c..d966815c 100644 --- a/src/Entity/RatioHistory.php +++ b/src/Entity/RatioHistory.php @@ -7,9 +7,6 @@ use DateTime; use DateTimeInterface; -/** - * Class RatioHistory. - */ class RatioHistory { protected ?int $id = null; @@ -23,14 +20,14 @@ public function __construct() $this->savedAt = new DateTime(); } - public function setId(mixed $id): self + public function setId(int $id): self { $this->id = $id; return $this; } - public function getId(): mixed + public function getId(): int { return $this->id; }