Skip to content

Commit 65e9395

Browse files
committed
optimize 2 nested if to one
1 parent 8a0432d commit 65e9395

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/AttributeFilter.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@ public function prepareProductAttributes(Product $product, array $productData, a
2929
{
3030
foreach ($productData as $attribute => $value) {
3131
$considerUseDefaultsAttribute = !isset($useDefaults[$attribute]) || $useDefaults[$attribute] === "1";
32-
if ($value === '' && $considerUseDefaultsAttribute) {
33-
/** @var $product Product */
34-
if ((bool)$product->getData($attribute) === false) {
35-
unset($productData[$attribute]);
36-
}
32+
if ($value === '' && $considerUseDefaultsAttribute && !$product->getData($attribute)) {
33+
unset($productData[$attribute]);
3734
}
3835
}
3936
return $productData;

0 commit comments

Comments
 (0)