Skip to content

Commit 251aa61

Browse files
authored
Merge pull request #1785 from algolia/feat/MAGE-1364-php4-nullable-types
MAGE-1364 MAGE-1365 PHP 8.4 implicit nullable types plus 8.2 base refactor
2 parents 3f70e6d + f472b1b commit 251aa61

File tree

110 files changed

+308
-392
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+308
-392
lines changed

Api/Insights/EventProcessorInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function convertAddToCart(
9191
string $eventName,
9292
string $indexName,
9393
Item $item,
94-
string $queryID = null
94+
?string $queryID = null
9595
): array;
9696

9797
/**
@@ -123,7 +123,7 @@ public function convertPurchaseForItems(
123123
string $eventName,
124124
string $indexName,
125125
array $items,
126-
string $queryID = null
126+
?string $queryID = null
127127
): array;
128128

129129
}

Block/Adminhtml/LandingPage/Edit/AbstractButton.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function getObject()
5252
$landingPage->getResource()->load($landingPage, $modelId);
5353

5454
return $landingPage;
55-
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
55+
} catch (\Magento\Framework\Exception\NoSuchEntityException) {
5656
}
5757

5858
return null;

Block/Adminhtml/Query/Edit/AbstractButton.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function getObject()
5252
$query->getResource()->load($query, $modelId);
5353

5454
return $query;
55-
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
55+
} catch (\Magento\Framework\Exception\NoSuchEntityException) {
5656
}
5757

5858
return null;

Block/Adminhtml/Queue/Status.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,12 @@ public function isQueueActive()
7070
public function getQueueRunnerStatus()
7171
{
7272
$status = 'unknown';
73-
switch ($this->queueRunnerIndexer->getStatus()) {
74-
case \Magento\Framework\Indexer\StateInterface::STATUS_VALID:
75-
$status = 'Ready';
76-
77-
break;
78-
case \Magento\Framework\Indexer\StateInterface::STATUS_INVALID:
79-
$status = 'Reindex required';
80-
81-
break;
82-
case \Magento\Framework\Indexer\StateInterface::STATUS_WORKING:
83-
$status = 'Processing';
84-
85-
break;
86-
}
73+
$status = match ($this->queueRunnerIndexer->getStatus()) {
74+
\Magento\Framework\Indexer\StateInterface::STATUS_VALID => 'Ready',
75+
\Magento\Framework\Indexer\StateInterface::STATUS_INVALID => 'Reindex required',
76+
\Magento\Framework\Indexer\StateInterface::STATUS_WORKING => 'Processing',
77+
default => $status,
78+
};
8779

8880
return $status;
8981
}

Block/Checkout/Conversion.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function getOrderItemsConversionJson()
5454
/** @var Item $item */
5555
foreach ($orderItems as $item) {
5656
if ($item->hasData(InsightsHelper::QUOTE_ITEM_QUERY_PARAM)) {
57-
$orderItemsData[$item->getProductId()] = json_decode($item->getData(InsightsHelper::QUOTE_ITEM_QUERY_PARAM));
57+
$orderItemsData[$item->getProductId()] = json_decode((string) $item->getData(InsightsHelper::QUOTE_ITEM_QUERY_PARAM));
5858
}
5959
}
6060

Block/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected function initCategoryParentPath(\Magento\Catalog\Model\Category $cat):
5757
* @param array $arr
5858
* @return array
5959
*/
60-
protected function getChildCategoryUrls(\Magento\Catalog\Model\Category $cat, string $parent = '', array $arr = array()): array {
60+
protected function getChildCategoryUrls(\Magento\Catalog\Model\Category $cat, string $parent = '', array $arr = []): array {
6161
if (!$parent) {
6262
$parent = $this->initCategoryParentPath($cat);
6363
}

Block/LandingPage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected function _prepareLayout()
9090
$page = $this->getPage();
9191
$this->pageConfig->addBodyClass('algolia-landingpage-' . $page->getUrlKey());
9292
$metaTitle = $page->getMetaTitle();
93-
$this->pageConfig->getTitle()->set($page->getTitle() ? $page->getTitle() : $metaTitle);
93+
$this->pageConfig->getTitle()->set($page->getTitle() ?: $metaTitle);
9494
$this->pageConfig->setKeywords($page->getMetaKeywords());
9595
$this->pageConfig->setDescription($page->getMetaDescription());
9696

Block/Navigation/Renderer/SliderRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,6 @@ private function getUrlTemplate()
158158
$regexp = "/({$filter->getRequestVar()})=(-?[0-9A-Z\-\%]+)/";
159159
$replacement = '${1}=<%- from %>-<%- to %>';
160160

161-
return preg_replace($regexp, $replacement, $item->getUrl());
161+
return preg_replace($regexp, $replacement, (string) $item->getUrl());
162162
}
163163
}

Block/System/Form/Field/Select.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ protected function _toHtml()
99
$this->setData('name', $this->getData('input_name'));
1010
$this->setClass('select');
1111

12-
return trim(preg_replace('/\s+/', ' ', parent::_toHtml()));
12+
return trim((string) preg_replace('/\s+/', ' ', parent::_toHtml()));
1313
}
1414
}

Block/Widget/LookingSimilar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function generateUniqueToken()
5151
*/
5252
public function getProductIds()
5353
{
54-
return json_encode(explode(",", $this->getData('productIds')));
54+
return json_encode(explode(",", (string) $this->getData('productIds')));
5555
}
5656

5757
/**

0 commit comments

Comments
 (0)