From 8a6ddf61811e8c3ca1a56ee68e37c4b29e272b20 Mon Sep 17 00:00:00 2001 From: Ibrahim Saleh <19901858+IbrahimS2@users.noreply.github.com> Date: Tue, 6 May 2025 16:26:59 +0300 Subject: [PATCH 1/7] Explicit nullable type must be used instead --- Block/Product/RatingSnippet.php | 8 ++++---- Block/Richsnippet.php | 2 +- Model/Api.php | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Block/Product/RatingSnippet.php b/Block/Product/RatingSnippet.php index c6227aa..5984513 100644 --- a/Block/Product/RatingSnippet.php +++ b/Block/Product/RatingSnippet.php @@ -39,10 +39,10 @@ public function __construct( \Magento\Catalog\Api\CategoryRepositoryInterface $categoryRepository, \Magento\Framework\Url\Helper\Data $urlHelper, array $data = [], - \Magento\Customer\Model\Session $customerSession = null, - \Magento\Catalog\Model\CategoryFactory $categoryFactory = null, - ReviewsConfig $reviewsConfigHelper = null, - StoreManagerInterface $storeManager = null + ?\Magento\Customer\Model\Session $customerSession = null, + ?\Magento\Catalog\Model\CategoryFactory $categoryFactory = null, + ?ReviewsConfig $reviewsConfigHelper = null, + ?StoreManagerInterface $storeManager = null ) { $this->_customerSession = $customerSession; $this->categoryFactory = $categoryFactory; diff --git a/Block/Richsnippet.php b/Block/Richsnippet.php index 008e214..2dd9067 100755 --- a/Block/Richsnippet.php +++ b/Block/Richsnippet.php @@ -85,7 +85,7 @@ public function getRichSnippetSource() return ''; } - public function getRichSnippet($sku = null, $product = null) + public function getRichSnippet(?$sku = null, ?$product = null) { if (isset($sku) && is_array($sku)) { $sku = implode(';', $sku); diff --git a/Model/Api.php b/Model/Api.php index dee0a0e..6d59409 100755 --- a/Model/Api.php +++ b/Model/Api.php @@ -25,7 +25,7 @@ public function __construct( $this->store = $storeManagerInterface->getStore(); } - public function apiPost($url, $data, $magento_store_id = null) + public function apiPost($url, $data, ?$magento_store_id = null) { if ($magento_store_id == null) { $magento_store_id = $this->store->getId(); @@ -51,7 +51,7 @@ public function apiPost($url, $data, $magento_store_id = null) return $response; } - protected function getApiDomain($magento_store_id = null) + protected function getApiDomain(?$magento_store_id = null) { return $this->configHelper->getRegion($magento_store_id) == 'US' ? 'api.reviews.io' : 'api.reviews.co.uk'; } From e0ef8a734011fad8cf317fd5abaa8248100b65e5 Mon Sep 17 00:00:00 2001 From: aj2967 Date: Tue, 24 Jun 2025 10:48:10 +0100 Subject: [PATCH 2/7] Add variable types --- Block/Richsnippet.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Block/Richsnippet.php b/Block/Richsnippet.php index 2dd9067..9f0e633 100755 --- a/Block/Richsnippet.php +++ b/Block/Richsnippet.php @@ -85,7 +85,7 @@ public function getRichSnippetSource() return ''; } - public function getRichSnippet(?$sku = null, ?$product = null) + public function getRichSnippet(?string $sku = null, ?array $product = null) { if (isset($sku) && is_array($sku)) { $sku = implode(';', $sku); From 2560914bf98375beb6c6611e9a6d593be5a23a6c Mon Sep 17 00:00:00 2001 From: aj2967 Date: Tue, 24 Jun 2025 11:35:29 +0100 Subject: [PATCH 3/7] Add rating snippet properties --- Block/Product/RatingSnippet.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Block/Product/RatingSnippet.php b/Block/Product/RatingSnippet.php index 5984513..ca1598d 100644 --- a/Block/Product/RatingSnippet.php +++ b/Block/Product/RatingSnippet.php @@ -14,12 +14,19 @@ class RatingSnippet extends ListProduct { + // protected $_storeManager = StoreManagerInterface::class; protected $_customerSession; + protected $reviewsConfig; + protected $postDataHelper; + protected $layerResolver; + protected $categoryRepository; + protected $urlHelper; + protected $customerSession; protected $categoryFactory; - //protected $reviewsConfig = Reviews\Helper\Config; - // protected $_storeManager = StoreManagerInterface::class; + protected $reviewsConfigHelper; + protected $storeManager; protected $store; - protected $reviewsConfig; + /** * ListProduct constructor. * @param \Magento\Catalog\Block\Product\Context $context From 97cf42390339abcd22de32783d9c9c5fb02e17bc Mon Sep 17 00:00:00 2001 From: aj2967 Date: Tue, 24 Jun 2025 14:41:25 +0100 Subject: [PATCH 4/7] Type hint --- Block/Product/RatingSnippet.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Block/Product/RatingSnippet.php b/Block/Product/RatingSnippet.php index ca1598d..d25023a 100644 --- a/Block/Product/RatingSnippet.php +++ b/Block/Product/RatingSnippet.php @@ -34,10 +34,11 @@ class RatingSnippet extends ListProduct * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver * @param \Magento\Catalog\Api\CategoryRepositoryInterface $categoryRepository * @param \Magento\Framework\Url\Helper\Data $urlHelper - * @param Helper $helper * @param array $data * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory + * @param \Reviewscouk\Reviews\Helper\Config $reviewsConfigHelper + * @param \Magento\Store\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\Catalog\Block\Product\Context $context, From fd9fe9ee8a1e9b7c3175bde7dc383861e2cc803f Mon Sep 17 00:00:00 2001 From: aj2967 Date: Tue, 24 Jun 2025 14:42:20 +0100 Subject: [PATCH 5/7] Add compatible nullable types --- Model/Api.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Model/Api.php b/Model/Api.php index 6d59409..79cca68 100755 --- a/Model/Api.php +++ b/Model/Api.php @@ -25,7 +25,7 @@ public function __construct( $this->store = $storeManagerInterface->getStore(); } - public function apiPost($url, $data, ?$magento_store_id = null) + public function apiPost($url, $data, ?string $magento_store_id = null) { if ($magento_store_id == null) { $magento_store_id = $this->store->getId(); @@ -51,7 +51,7 @@ public function apiPost($url, $data, ?$magento_store_id = null) return $response; } - protected function getApiDomain(?$magento_store_id = null) + protected function getApiDomain(?string $magento_store_id = null) { return $this->configHelper->getRegion($magento_store_id) == 'US' ? 'api.reviews.io' : 'api.reviews.co.uk'; } From 521e062442b41fd5fe1abf0daaab1f2f1f791f7a Mon Sep 17 00:00:00 2001 From: aj2967 Date: Thu, 26 Jun 2025 13:55:07 +0100 Subject: [PATCH 6/7] Use correct nullable type --- Block/Richsnippet.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Block/Richsnippet.php b/Block/Richsnippet.php index 9f0e633..f1a2915 100755 --- a/Block/Richsnippet.php +++ b/Block/Richsnippet.php @@ -85,7 +85,7 @@ public function getRichSnippetSource() return ''; } - public function getRichSnippet(?string $sku = null, ?array $product = null) + public function getRichSnippet(?array $sku = null, ?array $product = null) { if (isset($sku) && is_array($sku)) { $sku = implode(';', $sku); From 4b96f4abba174d58669258ed2793e461971f848d Mon Sep 17 00:00:00 2001 From: aj2967 Date: Fri, 8 Aug 2025 16:23:33 +0100 Subject: [PATCH 7/7] Update readme --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f74c094..bafe7a0 100755 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ You'll need to sign up at [Reviews.co.uk](https://www.reviews.co.uk "Reviews.co. | Magento Version | Php Version | REVIEWS.io Plugin Version | |-----------------|-------------|----------------------------| +| >= 2.4.8 | 8.3, 8.4 | reviewscouk/reviews:0.0.67 | | >= 2.4.6 | 8.1, 8.2 | reviewscouk/reviews:0.0.66 | | >= 2.4.4 | 8.1 | reviewscouk/reviews:0.0.66 | | <= 2.4.3 | <= 7.4 | reviewscouk/reviews:0.0.66 | @@ -18,7 +19,7 @@ You'll need to sign up at [Reviews.co.uk](https://www.reviews.co.uk "Reviews.co. 2. As this plugin is hosted on [packagist.org](http://packagist.org), you simply use the following to instruct composer to fetch and install the module: ```bash - composer require reviewscouk/reviews:0.0.66 + composer require reviewscouk/reviews:0.0.67 ``` 3. When this is complete, `cd` to `/bin` and run the following: