From d1be3e640dea1c75ab7efc842260fb591e36c376 Mon Sep 17 00:00:00 2001 From: Jonathan Sacksick <21182-jsacksick@users.noreply.drupalcode.org> Date: Fri, 3 Mar 2023 12:29:26 +0200 Subject: [PATCH] Issue #3345682 by jsacksick: Require commerceguys/intl version 2. --- composer.json | 4 ++-- ludwig.json | 4 ++-- modules/price/src/CurrencyImporterInterface.php | 2 +- modules/price/src/Repository/CurrencyRepository.php | 8 ++++---- .../price/src/Repository/NumberFormatRepository.php | 13 ++----------- 5 files changed, 11 insertions(+), 20 deletions(-) diff --git a/composer.json b/composer.json index 8e257f979..83b38ccec 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "homepage": "https://drupal.org/project/commerce", "license": "GPL-2.0-or-later", "require": { - "php": "^7.3 || ^8.0", + "php": "^8.0", "ext-bcmath": "*", "drupal/core": "^9.3 || ^10", "drupal/address": "^1.7", @@ -15,7 +15,7 @@ "drupal/profile": "^1.2", "drupal/state_machine": "^1.5", "drupal/token": "^1.7", - "commerceguys/intl": "^1.0.0" + "commerceguys/intl": "^2.0.2" }, "require-dev": { "drupal/entity_print": "^2.2", diff --git a/ludwig.json b/ludwig.json index c00a9f78b..cd6d55b0b 100644 --- a/ludwig.json +++ b/ludwig.json @@ -1,8 +1,8 @@ { "require": { "commerceguys/intl": { - "version": "v1.0.5", - "url": "https://github.com/commerceguys/intl/archive/v1.0.5.zip" + "version": "v2.0.1", + "url": "https://github.com/commerceguys/intl/archive/v2.0.2.zip" } } } diff --git a/modules/price/src/CurrencyImporterInterface.php b/modules/price/src/CurrencyImporterInterface.php index 768b3edeb..5a56b5e84 100644 --- a/modules/price/src/CurrencyImporterInterface.php +++ b/modules/price/src/CurrencyImporterInterface.php @@ -39,7 +39,7 @@ interface CurrencyImporterInterface { * The saved currency entity or NULL if the given country's currency * isn't known. * - * @throws \CommerceGuys\Intl\Exception\UnknownCountryException + * @throws \CommerceGuys\Addressing\Exception\UnknownCountryException * Thrown when the country couldn't be found in the library definitions. */ public function importByCountry($country_code); diff --git a/modules/price/src/Repository/CurrencyRepository.php b/modules/price/src/Repository/CurrencyRepository.php index c81903640..7a4ad92af 100644 --- a/modules/price/src/Repository/CurrencyRepository.php +++ b/modules/price/src/Repository/CurrencyRepository.php @@ -41,7 +41,7 @@ class CurrencyRepository extends ExternalCurrencyRepository implements CurrencyR /** * {@inheritdoc} */ - public function get($currency_code, $locale = NULL) { + public function get($currency_code, $locale = NULL): Currency { /** @var \Drupal\commerce_price\Entity\CurrencyInterface $currency */ $currency = $this->currencyStorage->load($currency_code); if (!$currency) { @@ -54,7 +54,7 @@ class CurrencyRepository extends ExternalCurrencyRepository implements CurrencyR /** * {@inheritdoc} */ - public function getAll($locale = NULL) { + public function getAll($locale = NULL): array { $all = []; /** @var \Drupal\commerce_price\Entity\CurrencyInterface[] $currencies */ $currencies = $this->currencyStorage->loadMultiple(); @@ -68,7 +68,7 @@ class CurrencyRepository extends ExternalCurrencyRepository implements CurrencyR /** * {@inheritdoc} */ - public function getList($locale = NULL) { + public function getList($locale = NULL): array { $list = []; /** @var \Drupal\commerce_price\Entity\CurrencyInterface[] $entities */ $currencies = $this->currencyStorage->loadMultiple(); @@ -88,7 +88,7 @@ class CurrencyRepository extends ExternalCurrencyRepository implements CurrencyR * @return \CommerceGuys\Intl\Currency\Currency * The currency value object. */ - protected function createValueObjectFromEntity(CurrencyInterface $currency) { + protected function createValueObjectFromEntity(CurrencyInterface $currency): Currency { return new Currency([ 'currency_code' => $currency->getCurrencyCode(), 'name' => $currency->getName(), diff --git a/modules/price/src/Repository/NumberFormatRepository.php b/modules/price/src/Repository/NumberFormatRepository.php index dbc227b85..265c46183 100644 --- a/modules/price/src/Repository/NumberFormatRepository.php +++ b/modules/price/src/Repository/NumberFormatRepository.php @@ -16,23 +16,14 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; */ class NumberFormatRepository extends ExternalNumberFormatRepository implements NumberFormatRepositoryInterface { - /** - * The event dispatcher. - * - * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface - */ - protected $eventDispatcher; - /** * Creates a NumberFormatRepository instance. * - * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher + * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher * The event dispatcher. */ - public function __construct(EventDispatcherInterface $event_dispatcher) { + public function __construct(protected EventDispatcherInterface $eventDispatcher) { parent::__construct(); - - $this->eventDispatcher = $event_dispatcher; } /** -- GitLab