Skip to content

Commit 8f491d3

Browse files
committed
building errors
1 parent 8048c09 commit 8f491d3

File tree

2 files changed

+122
-62
lines changed

2 files changed

+122
-62
lines changed

app/code/Magento/Wishlist/Model/Wishlist.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ class Wishlist extends AbstractModel implements IdentityInterface
176176
* @param DateTime $dateTime
177177
* @param ProductRepositoryInterface $productRepository
178178
* @param StockItemRepository $stockItemRepository
179+
* @param ScopeConfigInterface|null $scopeConfig
179180
* @param bool $useCurrentWebsite
180181
* @param array $data
181182
* @param Json|null $serializer
@@ -400,7 +401,7 @@ public function getItem($itemId)
400401
* Adding item to wishlist
401402
*
402403
* @param Item $item
403-
* @return $this
404+
* @return $this
404405
* @throws Exception
405406
*/
406407
public function addItem(Item $item)
@@ -424,7 +425,8 @@ public function addItem(Item $item)
424425
* @return Item|string
425426
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
426427
* @SuppressWarnings(PHPMD.NPathComplexity)
427-
*@throws LocalizedException
428+
* @throws LocalizedException
429+
* @throws InvalidArgumentException
428430
*/
429431
public function addNewItem($product, $buyRequest = null, $forciblySetQty = false)
430432
{
@@ -452,7 +454,8 @@ public function addNewItem($product, $buyRequest = null, $forciblySetQty = false
452454
throw new LocalizedException(__('Cannot specify product.'));
453455
}
454456

455-
$stockItem = $this->stockItemRepository->get($product->getId());
457+
/** @var \Magento\CatalogInventory\Api\Data\StockItemInterface $stockItem */
458+
$stockItem = $this->stockItemRepository->get($productId);
456459
$showOutOfStock = $this->scopeConfig->isSetFlag(
457460
Configuration::XML_PATH_SHOW_OUT_OF_STOCK,
458461
ScopeInterface::SCOPE_STORE
@@ -470,7 +473,7 @@ public function addNewItem($product, $buyRequest = null, $forciblySetQty = false
470473
if (!is_array($buyRequestData)) {
471474
$isInvalidItemConfiguration = true;
472475
}
473-
} catch (InvalidArgumentException $exception) {
476+
} catch (Exception $exception) {
474477
$isInvalidItemConfiguration = true;
475478
}
476479
if ($isInvalidItemConfiguration) {

0 commit comments

Comments
 (0)