Skip to content

Commit

Permalink
php74 support version
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-kl1 committed Jan 22, 2021
1 parent 4d74267 commit 5899d3a
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 58 deletions.
17 changes: 5 additions & 12 deletions Model/CanShowPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 5 additions & 12 deletions Model/IsSaleable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 2 additions & 8 deletions Observer/Product/IsSaleable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 2 additions & 8 deletions Plugin/Pricing/CanShowPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 2 additions & 8 deletions Plugin/Saleable/CanShowPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 1 addition & 4 deletions Test/Unit/Model/TestCanShowPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ final class TestCanShowPrice extends TestCase
*/
private $scopeConfig;

/**
* @var CanShowPrice
*/
private $canShowPrice;
private CanShowPrice $canShowPrice;

protected function setUp(): void
{
Expand Down
5 changes: 1 addition & 4 deletions Test/Unit/Model/TestIsSaleable.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ final class TestIsSaleable extends TestCase
*/
private $scopeConfig;

/**
* @var IsSaleable
*/
private $isSaleable;
private IsSaleable $isSaleable;

protected function setUp(): void
{
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"groups"
],
"require": {
"php": "^7.1",
"php": "^7.4",
"magento/framework": "*",
"magento/module-catalog": "*",
"magento/module-checkout": "*",
Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="catalog">
<group id="price">
<group id="price" showInWebsite="1">
<field id="restrict_show_price" translate="label" type="select" showInDefault="1" showInWebsite="1" showInStore="0" sortOrder="10" canRestore="1">
<label>Restrict Show Prices Mode</label>
<source_model>Magento\Config\Model\Config\Source\Enabledisable</source_model>
Expand Down

0 comments on commit 5899d3a

Please sign in to comment.