From 5899d3a734e16eaf87279069831d3d6d854791c9 Mon Sep 17 00:00:00 2001 From: Thomas Klein Date: Fri, 22 Jan 2021 10:15:09 +0100 Subject: [PATCH] php74 support version --- Model/CanShowPrice.php | 17 +++++------------ Model/IsSaleable.php | 17 +++++------------ Observer/Product/IsSaleable.php | 10 ++-------- Plugin/Pricing/CanShowPrice.php | 10 ++-------- Plugin/Saleable/CanShowPrice.php | 10 ++-------- Test/Unit/Model/TestCanShowPrice.php | 5 +---- Test/Unit/Model/TestIsSaleable.php | 5 +---- composer.json | 2 +- etc/adminhtml/system.xml | 2 +- 9 files changed, 20 insertions(+), 58 deletions(-) diff --git a/Model/CanShowPrice.php b/Model/CanShowPrice.php index 55593d9..0e5e71e 100644 --- a/Model/CanShowPrice.php +++ b/Model/CanShowPrice.php @@ -20,25 +20,18 @@ final class CanShowPrice implements CanShowPriceInterface private const CONFIG_PATH_RESTRICT_SHOW_PRICE = 'catalog/price/restrict_show_price'; private const CONFIG_PATH_CAN_SHOW_PRICE_GROUPS = 'catalog/price/can_show_price_groups'; - /** - * @var ScopeConfigInterface - */ - private $scopeConfig; + private ScopeConfigInterface $scopeConfig; - /** - * @var array|null - */ - private $allowedGroups; + private ?array $allowedGroups; - /** - * @var bool|null - */ - private $isEnabled; + private ?bool $isEnabled; public function __construct( ScopeConfigInterface $scopeConfig ) { $this->scopeConfig = $scopeConfig; + $this->allowedGroups = null; + $this->isEnabled = null; } public function canShowPrice(int $customerGroupId): bool diff --git a/Model/IsSaleable.php b/Model/IsSaleable.php index c05099d..ea24fa0 100644 --- a/Model/IsSaleable.php +++ b/Model/IsSaleable.php @@ -20,25 +20,18 @@ final class IsSaleable implements IsSaleableInterface private const CONFIG_PATH_RESTRICT_SALEABLE = 'checkout/cart/restrict_saleable'; private const CONFIG_PATH_IS_SALEABLE_GROUPS = 'checkout/cart/is_saleable_groups'; - /** - * @var ScopeConfigInterface - */ - private $scopeConfig; + private ScopeConfigInterface $scopeConfig; - /** - * @var array|null - */ - private $allowedGroups; + private ?array $allowedGroups; - /** - * @var bool|null - */ - private $isEnabled; + private ?bool $isEnabled; public function __construct( ScopeConfigInterface $scopeConfig ) { $this->scopeConfig = $scopeConfig; + $this->allowedGroups = null; + $this->isEnabled = null; } public function isSaleable(int $customerGroupId): bool diff --git a/Observer/Product/IsSaleable.php b/Observer/Product/IsSaleable.php index ae700e8..2706338 100644 --- a/Observer/Product/IsSaleable.php +++ b/Observer/Product/IsSaleable.php @@ -16,15 +16,9 @@ final class IsSaleable implements ObserverInterface { - /** - * @var HttpContext - */ - private $httpContext; + private HttpContext $httpContext; - /** - * @var IsSaleableInterface - */ - private $isSaleable; + private IsSaleableInterface $isSaleable; public function __construct( HttpContext $httpContext, diff --git a/Plugin/Pricing/CanShowPrice.php b/Plugin/Pricing/CanShowPrice.php index 4405675..8b67c28 100644 --- a/Plugin/Pricing/CanShowPrice.php +++ b/Plugin/Pricing/CanShowPrice.php @@ -14,15 +14,9 @@ final class CanShowPrice { - /** - * @var HttpContext - */ - private $httpContext; + private HttpContext $httpContext; - /** - * @var CanShowPriceInterface - */ - private $canShowPrice; + private CanShowPriceInterface $canShowPrice; public function __construct( HttpContext $httpContext, diff --git a/Plugin/Saleable/CanShowPrice.php b/Plugin/Saleable/CanShowPrice.php index 7e8a2ae..06d4423 100644 --- a/Plugin/Saleable/CanShowPrice.php +++ b/Plugin/Saleable/CanShowPrice.php @@ -14,15 +14,9 @@ final class CanShowPrice { - /** - * @var HttpContext - */ - private $httpContext; + private HttpContext $httpContext; - /** - * @var CanShowPriceInterface - */ - private $canShowPrice; + private CanShowPriceInterface $canShowPrice; public function __construct( HttpContext $httpContext, diff --git a/Test/Unit/Model/TestCanShowPrice.php b/Test/Unit/Model/TestCanShowPrice.php index fe000c8..a2c112f 100644 --- a/Test/Unit/Model/TestCanShowPrice.php +++ b/Test/Unit/Model/TestCanShowPrice.php @@ -19,10 +19,7 @@ final class TestCanShowPrice extends TestCase */ private $scopeConfig; - /** - * @var CanShowPrice - */ - private $canShowPrice; + private CanShowPrice $canShowPrice; protected function setUp(): void { diff --git a/Test/Unit/Model/TestIsSaleable.php b/Test/Unit/Model/TestIsSaleable.php index 0ca49a3..070f466 100644 --- a/Test/Unit/Model/TestIsSaleable.php +++ b/Test/Unit/Model/TestIsSaleable.php @@ -19,10 +19,7 @@ final class TestIsSaleable extends TestCase */ private $scopeConfig; - /** - * @var IsSaleable - */ - private $isSaleable; + private IsSaleable $isSaleable; protected function setUp(): void { diff --git a/composer.json b/composer.json index 1c13e69..603061c 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "groups" ], "require": { - "php": "^7.1", + "php": "^7.4", "magento/framework": "*", "magento/module-catalog": "*", "magento/module-checkout": "*", diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 3058b14..2b0fefb 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -8,7 +8,7 @@
- + Magento\Config\Model\Config\Source\Enabledisable