From fe7ffa2a482094e9d9e7a3fdae871b5570aacf01 Mon Sep 17 00:00:00 2001 From: Tim Taelman Date: Tue, 10 Feb 2026 09:20:35 +0100 Subject: [PATCH 1/2] PHP 8.4 support --- src/Model/TaxRate.php | 4 ++-- src/Model/TaxRateAmount.php | 2 +- src/Model/TaxRateAmountEntityInterface.php | 2 +- src/Model/TaxRateEntityInterface.php | 2 +- src/Repository/TaxTypeRepository.php | 2 +- src/Resolver/Context.php | 2 +- tests/Resolver/TaxRate/DefaultTaxRateResolverTest.php | 3 +++ tests/Resolver/TaxType/EuTaxTypeResolverTest.php | 2 +- 8 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/Model/TaxRate.php b/src/Model/TaxRate.php index 85c6ae5..410e262 100644 --- a/src/Model/TaxRate.php +++ b/src/Model/TaxRate.php @@ -76,7 +76,7 @@ public function getType() /** * {@inheritdoc} */ - public function setType(TaxTypeEntityInterface $type = null) + public function setType(TaxTypeEntityInterface|null $type = null) { $this->type = $type; @@ -166,7 +166,7 @@ public function hasAmounts() /** * {@inheritdoc} */ - public function getAmount(\DateTime $date = null) + public function getAmount(\DateTime|null $date = null) { if (is_null($date)) { // Initialize DateTime to the current date. diff --git a/src/Model/TaxRateAmount.php b/src/Model/TaxRateAmount.php index 0d6a1e5..f77718a 100644 --- a/src/Model/TaxRateAmount.php +++ b/src/Model/TaxRateAmount.php @@ -55,7 +55,7 @@ public function getRate() /** * {@inheritdoc} */ - public function setRate(TaxRateEntityInterface $rate = null) + public function setRate(TaxRateEntityInterface|null $rate = null) { $this->rate = $rate; diff --git a/src/Model/TaxRateAmountEntityInterface.php b/src/Model/TaxRateAmountEntityInterface.php index 166f208..fc60104 100644 --- a/src/Model/TaxRateAmountEntityInterface.php +++ b/src/Model/TaxRateAmountEntityInterface.php @@ -11,7 +11,7 @@ interface TaxRateAmountEntityInterface extends TaxRateAmountInterface * * @return self */ - public function setRate(TaxRateEntityInterface $rate = null); + public function setRate(TaxRateEntityInterface|null $rate = null); /** * Sets the tax rate amount id. diff --git a/src/Model/TaxRateEntityInterface.php b/src/Model/TaxRateEntityInterface.php index ba8592d..c5dd957 100644 --- a/src/Model/TaxRateEntityInterface.php +++ b/src/Model/TaxRateEntityInterface.php @@ -13,7 +13,7 @@ interface TaxRateEntityInterface extends TaxRateInterface * * @return self */ - public function setType(TaxTypeEntityInterface $type = null); + public function setType(TaxTypeEntityInterface|null $type = null); /** * Sets the tax rate id. diff --git a/src/Repository/TaxTypeRepository.php b/src/Repository/TaxTypeRepository.php index 4a2a958..96a3c56 100644 --- a/src/Repository/TaxTypeRepository.php +++ b/src/Repository/TaxTypeRepository.php @@ -48,7 +48,7 @@ class TaxTypeRepository implements TaxTypeRepositoryInterface * @param string $definitionPath The path to the tax type and zone * definitions. Defaults to 'resources/'. */ - public function __construct($definitionPath = null, ZoneRepositoryInterface $zoneRepository = null) + public function __construct(string|null $definitionPath = null, ZoneRepositoryInterface|null $zoneRepository = null) { $definitionPath = $definitionPath ?: __DIR__ . '/../../resources/'; $this->definitionPath = $definitionPath . 'tax_type/'; diff --git a/src/Resolver/Context.php b/src/Resolver/Context.php index 0b623f6..1fe99c2 100644 --- a/src/Resolver/Context.php +++ b/src/Resolver/Context.php @@ -58,7 +58,7 @@ class Context * @param array $storeRegistrations * @param \DateTime $date */ - public function __construct(AddressInterface $customerAddress, AddressInterface $storeAddress, $customerTaxNumber = '', array $storeRegistrations = [], \DateTime $date = null) + public function __construct(AddressInterface $customerAddress, AddressInterface $storeAddress, $customerTaxNumber = '', array $storeRegistrations = [], \DateTime|null $date = null) { $this->customerAddress = $customerAddress; $this->storeAddress = $storeAddress; diff --git a/tests/Resolver/TaxRate/DefaultTaxRateResolverTest.php b/tests/Resolver/TaxRate/DefaultTaxRateResolverTest.php index 9413375..5ccc65e 100644 --- a/tests/Resolver/TaxRate/DefaultTaxRateResolverTest.php +++ b/tests/Resolver/TaxRate/DefaultTaxRateResolverTest.php @@ -3,6 +3,7 @@ namespace CommerceGuys\Tax\Tests\Resolver; use CommerceGuys\Tax\Resolver\TaxRate\DefaultTaxRateResolver; +use CommerceGuys\Tax\Resolver\TaxRate\TaxRateResolverInterface; use PHPUnit\Framework\TestCase; /** @@ -10,6 +11,8 @@ */ class DefaultTaxRateResolverTest extends TestCase { + + protected TaxRateResolverInterface $resolver; /** * {@inheritdoc} */ diff --git a/tests/Resolver/TaxType/EuTaxTypeResolverTest.php b/tests/Resolver/TaxType/EuTaxTypeResolverTest.php index 3f7c90a..02a3977 100644 --- a/tests/Resolver/TaxType/EuTaxTypeResolverTest.php +++ b/tests/Resolver/TaxType/EuTaxTypeResolverTest.php @@ -287,7 +287,7 @@ public function dataProvider() * * @return \CommerceGuys\Tax\Resolver\Context */ - protected function getContext($customerAddress, $storeAddress, $customerTaxNumber = '', $storeRegistrations = [], $date = null) + protected function getContext($customerAddress, $storeAddress, $customerTaxNumber = '', $storeRegistrations = [], \DateTime|null $date = null) { $context = $this ->getMockBuilder('CommerceGuys\Tax\Resolver\Context') From cd30a959b5152938fef045522def4f6c588fc4b8 Mon Sep 17 00:00:00 2001 From: Tim Taelman Date: Tue, 10 Feb 2026 10:57:32 +0100 Subject: [PATCH 2/2] addressing 2 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index cd4e942..2cdbdc2 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "license": "MIT", "require": { "php": ">=5.5.0", - "commerceguys/addressing": "^1.0", + "commerceguys/addressing": "^1.0 || ^2.0", "commerceguys/zone": "^0.8", "doctrine/collections": "^1.0 || ^2.0" },