The Review::beforeGetReviewsSummaryHtml() method can be simplified by removing the unused $templateType and $displayIfNoReviews arguments

This an be simplified to:

/**
 * Initialize product review
 *
 * @param \Magento\Catalog\Block\Product\Compare\ListCompare $subject
 * @param \Magento\Catalog\Model\Product $product
 *
 * @return void
 */
public function beforeGetReviewsSummaryHtml(
	\Magento\Catalog\Block\Product\Compare\ListCompare $subject,
	\Magento\Catalog\Model\Product $product
) {
	if (!$product->getRatingSummary()) {
		$this->reviewFactory->create()->getEntitySummary($product, $this->storeManager->getStore()->getId());
	}
}

A trick: a «before» plugin can avoid declaration of unused last arguments if it needs not modify any argument

1 Like