From f1408cc60eec74dc5204f2b46948a07e95a4aff1 Mon Sep 17 00:00:00 2001 From: Roshyo Date: Thu, 15 Jul 2021 07:48:46 +0200 Subject: [PATCH 1/2] Fix deprecation of ShippingMethodEligibilityCheckerInterface Fix also some notices --- .../TableRateShippingMethodEligibilityChecker.php | 2 +- src/Entity/ShippingTableRate.php | 10 +++++----- src/EventSubscriber/TableRateDeleteSubscriber.php | 2 +- src/Form/EventSubscriber/AddCurrencySubscriber.php | 2 +- .../ChannelBasedTableRateConfigurationType.php | 2 +- src/Resolver/TableRateResolver.php | 1 + 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Checker/TableRateShippingMethodEligibilityChecker.php b/src/Checker/TableRateShippingMethodEligibilityChecker.php index 49d0259..0cdc50d 100644 --- a/src/Checker/TableRateShippingMethodEligibilityChecker.php +++ b/src/Checker/TableRateShippingMethodEligibilityChecker.php @@ -5,7 +5,7 @@ namespace Webgriffe\SyliusTableRateShippingPlugin\Checker; use Sylius\Component\Core\Model\ShipmentInterface; -use Sylius\Component\Shipping\Checker\ShippingMethodEligibilityCheckerInterface; +use Sylius\Component\Shipping\Checker\Eligibility\ShippingMethodEligibilityCheckerInterface; use Sylius\Component\Shipping\Model\ShippingMethodInterface; use Sylius\Component\Shipping\Model\ShippingSubjectInterface; use Webgriffe\SyliusTableRateShippingPlugin\Calculator\TableRateShippingCalculator; diff --git a/src/Entity/ShippingTableRate.php b/src/Entity/ShippingTableRate.php index 07ff85c..dfe5370 100644 --- a/src/Entity/ShippingTableRate.php +++ b/src/Entity/ShippingTableRate.php @@ -17,28 +17,28 @@ class ShippingTableRate implements ResourceInterface, CodeAwareInterface { /** @var int|null */ - private $id; + protected $id; /** * @var string|null * * @Assert\NotBlank(groups={"sylius"}) */ - private $code; + protected $code; /** * @var string|null * * @Assert\NotBlank(groups={"sylius"}) */ - private $name; + protected $name; /** * @var CurrencyInterface|null * * @Assert\NotBlank(groups={"sylius"}) */ - private $currency; + protected $currency; /** * @var array @@ -48,7 +48,7 @@ class ShippingTableRate implements ResourceInterface, CodeAwareInterface * message="webgriffe_sylius_table_rate_plugin.ui.shipping_table_rate.weightLimitToRate.not_blank" * ) */ - private $weightLimitToRate = []; + protected $weightLimitToRate = []; public function getId(): ?int { diff --git a/src/EventSubscriber/TableRateDeleteSubscriber.php b/src/EventSubscriber/TableRateDeleteSubscriber.php index e6d77d2..fa0a11e 100644 --- a/src/EventSubscriber/TableRateDeleteSubscriber.php +++ b/src/EventSubscriber/TableRateDeleteSubscriber.php @@ -25,7 +25,7 @@ public function __construct(ShippingMethodRepositoryInterface $shippingMethodRep /** * {@inheritdoc} */ - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return ['webgriffe.shipping_table_rate.pre_delete' => 'onTableRatePreDelete']; } diff --git a/src/Form/EventSubscriber/AddCurrencySubscriber.php b/src/Form/EventSubscriber/AddCurrencySubscriber.php index 4a1ebf7..c484745 100644 --- a/src/Form/EventSubscriber/AddCurrencySubscriber.php +++ b/src/Form/EventSubscriber/AddCurrencySubscriber.php @@ -15,7 +15,7 @@ class AddCurrencySubscriber implements EventSubscriberInterface /** * {@inheritdoc} */ - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [FormEvents::PRE_SET_DATA => 'preSetData']; } diff --git a/src/Form/Type/Shipping/Calculator/ChannelBasedTableRateConfigurationType.php b/src/Form/Type/Shipping/Calculator/ChannelBasedTableRateConfigurationType.php index 36320f9..454692f 100644 --- a/src/Form/Type/Shipping/Calculator/ChannelBasedTableRateConfigurationType.php +++ b/src/Form/Type/Shipping/Calculator/ChannelBasedTableRateConfigurationType.php @@ -28,7 +28,7 @@ public function getParent(): string return ChannelCollectionType::class; } - public function getBlockPrefix() + public function getBlockPrefix(): string { return 'webgriffe_sylius_table_rate_shipping_plugin_calculator_channel_based_table_rate'; } diff --git a/src/Resolver/TableRateResolver.php b/src/Resolver/TableRateResolver.php index d697b4d..cf075bf 100644 --- a/src/Resolver/TableRateResolver.php +++ b/src/Resolver/TableRateResolver.php @@ -57,6 +57,7 @@ public function resolve(ShipmentInterface $shipment, array $calculatorConfig): S /** @var ShippingTableRate $tableRate */ $tableRate = $calculatorConfig[$channelCode][TableRateConfigurationType::TABLE_RATE_FIELD_NAME]; + /** @var ShippingTableRate $tableRate */ $tableRate = $this->tableRateRepository->findOneBy(['code' => $tableRate->getCode()]); Assert::isInstanceOf($tableRate, ShippingTableRate::class); From 253ff1be7f6a9f983c0baf135ebbbcf618fc3663 Mon Sep 17 00:00:00 2001 From: Roshyo Date: Thu, 15 Jul 2021 07:49:56 +0200 Subject: [PATCH 2/2] Revert unwanted change --- src/Entity/ShippingTableRate.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Entity/ShippingTableRate.php b/src/Entity/ShippingTableRate.php index dfe5370..07ff85c 100644 --- a/src/Entity/ShippingTableRate.php +++ b/src/Entity/ShippingTableRate.php @@ -17,28 +17,28 @@ class ShippingTableRate implements ResourceInterface, CodeAwareInterface { /** @var int|null */ - protected $id; + private $id; /** * @var string|null * * @Assert\NotBlank(groups={"sylius"}) */ - protected $code; + private $code; /** * @var string|null * * @Assert\NotBlank(groups={"sylius"}) */ - protected $name; + private $name; /** * @var CurrencyInterface|null * * @Assert\NotBlank(groups={"sylius"}) */ - protected $currency; + private $currency; /** * @var array @@ -48,7 +48,7 @@ class ShippingTableRate implements ResourceInterface, CodeAwareInterface * message="webgriffe_sylius_table_rate_plugin.ui.shipping_table_rate.weightLimitToRate.not_blank" * ) */ - protected $weightLimitToRate = []; + private $weightLimitToRate = []; public function getId(): ?int {