Skip to content

Commit

Permalink
Fix PHP 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jissereitsma committed Feb 6, 2024
1 parent 1a09495 commit 77f6aab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Util/CategoryProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,12 @@ public function getFirstByProduct(ProductInterface $product): CategoryInterface
$category = $subject->getLoadedCategories()[$productCategoryId] ?? null;
}
}

if ($category instanceof CategoryInterface) {
return $category;
}

return $category ?? throw new NoSuchEntityException(__('Product "%1" has no categories', $product->getSku()));
throw new NoSuchEntityException(__('Product "%1" has no categories', $product->getSku()));
}

/**
Expand Down

0 comments on commit 77f6aab

Please sign in to comment.