Skip to content

Commit 0ad8dc2

Browse files
committed
Refactor: PriceBackend plugin
1 parent 2c173c9 commit 0ad8dc2

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
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
{
@@ -26,12 +27,10 @@ public function aroundValidate(
2627
\Closure $proceed,
2728
$object
2829
) {
29-
if ($object instanceof \Magento\Catalog\Model\Product
30-
&& $object->getTypeId() == Configurable::TYPE_CODE
31-
) {
30+
if ($object instanceof ProductInterface && $object->getTypeId() === Configurable::TYPE_CODE) {
3231
return true;
33-
} else {
34-
return $proceed($object);
3532
}
33+
34+
return $proceed($object);
3635
}
3736
}

0 commit comments

Comments
 (0)