Skip to content

Commit cab7c3f

Browse files
committed
Fixing merge conflict issues in AttributeValidation
1 parent 59651f5 commit cab7c3f

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

app/code/Magento/ConfigurableProduct/Plugin/Model/Attribute/Backend/AttributeValidation.php

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

98
namespace Magento\ConfigurableProduct\Plugin\Model\Attribute\Backend;
@@ -24,12 +23,10 @@ class AttributeValidation
2423
* @var Configurable
2524
*/
2625
private $configurableProductType;
27-
2826
/**
2927
* @var array
3028
*/
3129
private $unskippableAttributes;
32-
3330
/**
3431
* @param Configurable $configurableProductType
3532
* @param array|null $unskippableAttributes
@@ -41,28 +38,24 @@ public function __construct(
4138
$this->configurableProductType = $configurableProductType;
4239
$this->unskippableAttributes = $unskippableAttributes;
4340
}
44-
4541
/**
46-
* Around plugin to skip attribute validation used for create configurable product.
42+
* Verify is attribute used for configurable product creation and should not be validated.
4743
*
4844
* @param AbstractBackend $subject
49-
* @param Closure $proceed
45+
* @param \Closure $proceed
5046
* @param DataObject $entity
5147
* @return bool
5248
*/
53-
public function aroundValidate(
54-
AbstractBackend $subject,
55-
Closure $proceed,
56-
DataObject $entity
57-
) {
49+
public function aroundValidate(AbstractBackend $subject, Closure $proceed, DataObject $entity)
50+
{
5851
$attribute = $subject->getAttribute();
59-
if ($this->isAttributeShouldNotBeValidated($entity, $attribute)) {
52+
if ($this->isAttributeShouldNotBeValidated($entity, $attribute)
53+
&& !in_array($attribute->getAttributeCode(), $this->unskippableAttributes)
54+
) {
6055
return true;
6156
}
62-
6357
return $proceed($entity);
6458
}
65-
6659
/**
6760
* Verify if attribute is a part of configurable product and should not be validated.
6861
*
@@ -72,10 +65,7 @@ public function aroundValidate(
7265
*/
7366
private function isAttributeShouldNotBeValidated(DataObject $entity, AbstractAttribute $attribute): bool
7467
{
75-
if (!($entity instanceof ProductInterface
76-
&& $entity->getTypeId() == Configurable::TYPE_CODE)
77-
&& in_array($attribute->getAttributeCode(), $this->unskippableAttributes)
78-
) {
68+
if (!($entity instanceof ProductInterface && $entity->getTypeId() === Configurable::TYPE_CODE)) {
7969
return false;
8070
}
8171
$attributeId = $attribute->getAttributeId();

0 commit comments

Comments
 (0)