Skip to content

Commit 1c1768b

Browse files
committed
MAGE-1365 Perform code cleanup for baseline PHP 8.2 compatibility
1 parent c971356 commit 1c1768b

File tree

91 files changed

+202
-281
lines changed

Some content is hidden

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

91 files changed

+202
-281
lines changed

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
/**

Console/Command/AbstractStoreCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ protected function getStoreIds(InputInterface $input): array
8787
protected function validateStoreIds(array $storeIds): array
8888
{
8989
foreach ($storeIds as $storeId) {
90-
if (!ctype_digit($storeId) || (int) $storeId < 1) {
90+
if (!ctype_digit((string) $storeId) || (int) $storeId < 1) {
9191
throw new LocalizedException(__("Store ID argument must be an integer"));
9292
}
9393
}
@@ -123,7 +123,7 @@ protected function decorateOperationAnnouncementMessage(string $msg, array $stor
123123
{
124124
$msg = str_replace('{{target}}', $this->getOperationTargetLabel($storeIds), $msg);
125125
return ($storeIds)
126-
? "<info>$msg: " . join(", ", $this->storeNameFetcher->getStoreNames($storeIds)) . '</info>'
126+
? "<info>$msg: " . implode(", ", $this->storeNameFetcher->getStoreNames($storeIds)) . '</info>'
127127
: "<info>$msg</info>";
128128
}
129129

0 commit comments

Comments
 (0)