Skip to content

Commit e22aa46

Browse files
committed
Merge remote-tracking branch '31360/refactor/around-plugins' into comm_78764_31355
2 parents 49bccdd + 8b57109 commit e22aa46

File tree

5 files changed

+36
-30
lines changed

5 files changed

+36
-30
lines changed

app/code/Magento/Bundle/Model/Plugin/PriceBackend.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
<?php
2+
23
/**
34
* Copyright © Magento, Inc. All rights reserved.
45
* See COPYING.txt for license details.
56
*/
7+
declare(strict_types=1);
8+
69
namespace Magento\Bundle\Model\Plugin;
710

811
/**
9-
* Class PriceBackend
10-
*
11-
* Make price validation optional for bundle dynamic
12+
* Make price validation optional for bundle dynamic
1213
*/
1314
class PriceBackend
1415
{
1516
/**
17+
* Around validate
18+
*
1619
* @param \Magento\Catalog\Model\Product\Attribute\Backend\Price $subject
1720
* @param \Closure $proceed
1821
* @param \Magento\Catalog\Model\Product|\Magento\Framework\DataObject $object
@@ -30,6 +33,7 @@ public function aroundValidate(
3033
) {
3134
return true;
3235
}
36+
3337
return $proceed($object);
3438
}
3539
}

app/code/Magento/ConfigurableProduct/Model/Plugin/PriceBackend.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\ConfigurableProduct\Model\Plugin;
79

10+
use Magento\Catalog\Api\Data\ProductInterface;
811
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
912

1013
/**
11-
* Class PriceBackend
12-
*
13-
* Make price validation optional for configurable product
14+
* Make price validation optional for configurable product
1415
*/
1516
class PriceBackend
1617
{
1718
/**
19+
* Around validate
20+
*
1821
* @param \Magento\Catalog\Model\Product\Attribute\Backend\Price $subject
1922
* @param \Closure $proceed
2023
* @param \Magento\Catalog\Model\Product|\Magento\Framework\DataObject $object
@@ -26,12 +29,10 @@ public function aroundValidate(
2629
\Closure $proceed,
2730
$object
2831
) {
29-
if ($object instanceof \Magento\Catalog\Model\Product
30-
&& $object->getTypeId() == Configurable::TYPE_CODE
31-
) {
32+
if ($object instanceof ProductInterface && $object->getTypeId() === Configurable::TYPE_CODE) {
3233
return true;
33-
} else {
34-
return $proceed($object);
3534
}
35+
36+
return $proceed($object);
3637
}
3738
}

app/code/Magento/Store/Url/Plugin/SecurityInfo.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Store\Url\Plugin;
79

8-
use \Magento\Store\Model\Store;
9-
use \Magento\Store\Model\ScopeInterface as StoreScopeInterface;
10+
use Magento\Store\Model\ScopeInterface as StoreScopeInterface;
11+
use Magento\Store\Model\Store;
1012

1113
/**
1214
* Plugin for \Magento\Framework\Url\SecurityInfo
@@ -39,8 +41,8 @@ public function aroundIsSecure(\Magento\Framework\Url\SecurityInfo $subject, \Cl
3941
{
4042
if ($this->scopeConfig->getValue(Store::XML_PATH_SECURE_IN_FRONTEND, StoreScopeInterface::SCOPE_STORE)) {
4143
return $proceed($url);
42-
} else {
43-
return false;
4444
}
45+
46+
return false;
4547
}
4648
}

app/code/Magento/Webapi/Model/Plugin/GuestAuthorization.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Webapi\Model\Plugin;
89

@@ -11,7 +12,7 @@
1112
/**
1213
* Plugin around \Magento\Framework\Authorization::isAllowed
1314
*
14-
* Plugin to allow guest users to access resources with anonymous permission
15+
* Allow guest users to access resources with "anonymous" resource
1516
*/
1617
class GuestAuthorization
1718
{
@@ -22,8 +23,7 @@ class GuestAuthorization
2223
* @param \Closure $proceed
2324
* @param string $resource
2425
* @param string $privilege
25-
* @return bool true If resource permission is anonymous,
26-
* to allow any user access without further checks in parent method
26+
* @return bool Is resource permission "anonymous", to allow any user access without further checks in parent method
2727
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
2828
*/
2929
public function aroundIsAllowed(
@@ -32,10 +32,10 @@ public function aroundIsAllowed(
3232
$resource,
3333
$privilege = null
3434
) {
35-
if ($resource == AuthorizationService::PERMISSION_ANONYMOUS) {
35+
if ($resource === AuthorizationService::PERMISSION_ANONYMOUS) {
3636
return true;
37-
} else {
38-
return $proceed($resource, $privilege);
3937
}
38+
39+
return $proceed($resource, $privilege);
4040
}
4141
}

app/code/Magento/Widget/Model/ResourceModel/Layout/Plugin.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
11
<?php
2+
23
/**
34
* Copyright © Magento, Inc. All rights reserved.
45
* See COPYING.txt for license details.
56
*/
7+
declare(strict_types=1);
8+
69
namespace Magento\Widget\Model\ResourceModel\Layout;
710

8-
/**
9-
* Class Plugin
10-
*/
1111
class Plugin
1212
{
1313
/**
14-
* @var \Magento\Widget\Model\ResourceModel\Layout\Update
14+
* @var Update
1515
*/
1616
private $update;
1717

1818
/**
19-
* @param \Magento\Widget\Model\ResourceModel\Layout\Update $update
19+
* @param Update $update
2020
*/
21-
public function __construct(
22-
\Magento\Widget\Model\ResourceModel\Layout\Update $update
23-
) {
21+
public function __construct(Update $update)
22+
{
2423
$this->update = $update;
2524
}
2625

2726
/**
28-
* Around getDbUpdateString
27+
* Around update
2928
*
3029
* @param \Magento\Framework\View\Model\Layout\Merge $subject
3130
* @param callable $proceed

0 commit comments

Comments
 (0)