Skip to content

Commit dc74ad7

Browse files
committed
MAGE-1364 Apply type fixes for PHP 8.4
1 parent 14eda68 commit dc74ad7

File tree

3 files changed

+12
-22
lines changed

3 files changed

+12
-22
lines changed

Helper/ConfigHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ public function getCategoryPageIdAttributeName($storeId = null): string
763763
/**
764764
* @throws \Magento\Framework\Exception\NoSuchEntityException
765765
*/
766-
public function getCurrencyCode(int $storeId = null): string
766+
public function getCurrencyCode(?int $storeId = null): string
767767
{
768768
/** @var \Magento\Store\Model\Store $store */
769769
$store = $this->storeManager->getStore($storeId);

Model/Indexer/ProductObserver.php

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,19 @@ class ProductObserver
1313
/** @var Product */
1414
private $indexer;
1515

16-
/** @var ConfigHelper */
17-
private $configHelper;
18-
19-
/**
20-
* @param IndexerRegistry $indexerRegistry
21-
* @param ConfigHelper $configHelper
22-
*/
23-
public function __construct(IndexerRegistry $indexerRegistry, ConfigHelper $configHelper)
16+
public function __construct(IndexerRegistry $indexerRegistry)
2417
{
2518
$this->indexer = $indexerRegistry->get('algolia_products');
26-
$this->configHelper = $configHelper;
2719
}
2820

2921
/**
3022
* @param ProductResource $productResource
3123
* @param ProductResource $result
3224
* @param ProductModel $product
3325
*
34-
* @return ProductModel[]
26+
* @return ProductResource
3527
*/
36-
public function afterSave(ProductResource $productResource, ProductResource $result, ProductModel $product)
28+
public function afterSave(ProductResource $productResource, ProductResource $result, ProductModel $product): ProductResource
3729
{
3830
$productResource->addCommitCallback(function () use ($product) {
3931
if (!$this->indexer->isScheduled()) {
@@ -49,9 +41,9 @@ public function afterSave(ProductResource $productResource, ProductResource $res
4941
* @param ProductResource $result
5042
* @param ProductModel $product
5143
*
52-
* @return ProductModel[]
44+
* @return ProductResource
5345
*/
54-
public function afterDelete(ProductResource $productResource, ProductResource $result, ProductModel $product)
46+
public function afterDelete(ProductResource $productResource, ProductResource $result, ProductModel $product): ProductResource
5547
{
5648
$productResource->addCommitCallback(function () use ($product) {
5749
if (!$this->indexer->isScheduled()) {
@@ -69,7 +61,7 @@ public function afterDelete(ProductResource $productResource, ProductResource $r
6961
*
7062
* @return Action
7163
*/
72-
public function afterUpdateAttributes(Action $subject, Action $result, $productIds)
64+
public function afterUpdateAttributes(Action $subject, Action $result, array $productIds): Action
7365
{
7466
if (!$this->indexer->isScheduled()) {
7567
$this->indexer->reindexList(array_unique($productIds));
@@ -80,17 +72,15 @@ public function afterUpdateAttributes(Action $subject, Action $result, $productI
8072

8173
/**
8274
* @param Action $subject
83-
* @param Action $result
75+
* @param null $result
8476
* @param array $productIds
8577
*
86-
* @return mixed
78+
* @return void
8779
*/
88-
public function afterUpdateWebsites(Action $subject, Action $result, array $productIds)
80+
public function afterUpdateWebsites(Action $subject, null $result, array $productIds): void
8981
{
9082
if (!$this->indexer->isScheduled()) {
9183
$this->indexer->reindexList(array_unique($productIds));
9284
}
93-
94-
return $result;
9585
}
9686
}

Plugin/StockItemObserver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ public function beforeSave(
3838

3939
/**
4040
* @param \Magento\CatalogInventory\Model\ResourceModel\Stock\Item $stockItemResource
41-
* @param \Magento\CatalogInventory\Model\ResourceModel\Stock\Item|null $result
41+
* @param \Magento\CatalogInventory\Model\ResourceModel\Stock\Item $result
4242
* @param \Magento\CatalogInventory\Api\Data\StockItemInterface $stockItem
43-
* @return \Magento\CatalogInventory\Model\ResourceModel\Stock\Item|null
43+
* @return \Magento\CatalogInventory\Model\ResourceModel\Stock\Item
4444
*/
4545
public function afterDelete(
4646
\Magento\CatalogInventory\Model\ResourceModel\Stock\Item $stockItemResource,

0 commit comments

Comments
 (0)