Skip to content

Commit 447a917

Browse files
hryvinskyitorhoehn
authored andcommitted
Add Clean Code
1 parent de27216 commit 447a917

File tree

1 file changed

+5
-1
lines changed
  • app/code/Magento/GroupedProduct/Model/Product/Initialization/Helper/ProductLinks/Plugin

1 file changed

+5
-1
lines changed

app/code/Magento/GroupedProduct/Model/Product/Initialization/Helper/ProductLinks/Plugin/Grouped.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Magento\Catalog\Api\Data\ProductLinkExtensionFactory;
99
use Magento\Catalog\Api\Data\ProductLinkInterfaceFactory;
1010
use Magento\Catalog\Api\ProductRepositoryInterface;
11+
use Magento\Framework\Exception\NoSuchEntityException;
1112
use Magento\GroupedProduct\Model\Product\Type\Grouped as TypeGrouped;
1213

1314
/**
@@ -60,6 +61,9 @@ public function __construct(
6061
* @param array $links
6162
*
6263
* @return \Magento\Catalog\Model\Product
64+
*
65+
* @throws NoSuchEntityException
66+
*
6367
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
6468
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
6569
* @SuppressWarnings(PHPMD.NPathComplexity)
@@ -70,7 +74,7 @@ public function beforeInitializeLinks(
7074
array $links
7175
) {
7276
if ($product->getTypeId() === TypeGrouped::TYPE_CODE && !$product->getGroupedReadonly()) {
73-
$links = (isset($links[self::TYPE_NAME])) ? $links[self::TYPE_NAME] : $product->getGroupedLinkData();
77+
$links = $links[self::TYPE_NAME] ?? $product->getGroupedLinkData();
7478
if (!is_array($links)) {
7579
$links = [];
7680
}

0 commit comments

Comments
 (0)