Skip to content

Commit ffa82a8

Browse files
authored
Merge branch '2.4-develop' into B2B-2217-gql
2 parents f5f682f + 9661597 commit ffa82a8

File tree

63 files changed

+1332
-571
lines changed

Some content is hidden

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

63 files changed

+1332
-571
lines changed

app/code/Magento/AdminNotification/Model/Feed.php

Lines changed: 53 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,22 @@
55
*/
66
namespace Magento\AdminNotification\Model;
77

8-
use Magento\Framework\Escaper;
8+
use Magento\AdminNotification\Model\InboxFactory;
9+
use Magento\Backend\App\ConfigInterface;
10+
use Magento\Framework\App\DeploymentConfig;
911
use Magento\Framework\App\ObjectManager;
12+
use Magento\Framework\App\ProductMetadataInterface;
1013
use Magento\Framework\Config\ConfigOptionsListConstants;
14+
use Magento\Framework\Data\Collection\AbstractDb;
15+
use Magento\Framework\Escaper;
16+
use Magento\Framework\HTTP\Adapter\Curl;
17+
use Magento\Framework\HTTP\Adapter\CurlFactory;
18+
use Magento\Framework\Model\AbstractModel;
19+
use Magento\Framework\Model\Context;
20+
use Magento\Framework\Model\ResourceModel\AbstractResource;
21+
use Magento\Framework\Registry;
22+
use Magento\Framework\UrlInterface;
23+
use SimpleXMLElement;
1124

1225
/**
1326
* AdminNotification Feed model
@@ -16,87 +29,85 @@
1629
* @api
1730
* @since 100.0.2
1831
*/
19-
class Feed extends \Magento\Framework\Model\AbstractModel
32+
class Feed extends AbstractModel
2033
{
21-
const XML_USE_HTTPS_PATH = 'system/adminnotification/use_https';
34+
public const XML_USE_HTTPS_PATH = 'system/adminnotification/use_https';
2235

23-
const XML_FEED_URL_PATH = 'system/adminnotification/feed_url';
36+
public const XML_FEED_URL_PATH = 'system/adminnotification/feed_url';
2437

25-
const XML_FREQUENCY_PATH = 'system/adminnotification/frequency';
38+
public const XML_FREQUENCY_PATH = 'system/adminnotification/frequency';
2639

27-
const XML_LAST_UPDATE_PATH = 'system/adminnotification/last_update';
40+
public const XML_LAST_UPDATE_PATH = 'system/adminnotification/last_update';
2841

2942
/**
3043
* @var Escaper
3144
*/
3245
private $escaper;
3346

3447
/**
35-
* Feed url
36-
*
3748
* @var string
3849
*/
3950
protected $_feedUrl;
4051

4152
/**
42-
* @var \Magento\Backend\App\ConfigInterface
53+
* @var ConfigInterface
4354
*/
4455
protected $_backendConfig;
4556

4657
/**
47-
* @var \Magento\AdminNotification\Model\InboxFactory
58+
* @var InboxFactory
4859
*/
4960
protected $_inboxFactory;
5061

5162
/**
52-
* @var \Magento\Framework\HTTP\Adapter\CurlFactory
63+
* @var CurlFactory
5364
*
5465
*/
5566
protected $curlFactory;
5667

5768
/**
5869
* Deployment configuration
5970
*
60-
* @var \Magento\Framework\App\DeploymentConfig
71+
* @var DeploymentConfig
6172
*/
6273
protected $_deploymentConfig;
6374

6475
/**
65-
* @var \Magento\Framework\App\ProductMetadataInterface
76+
* @var ProductMetadataInterface
6677
*/
6778
protected $productMetadata;
6879

6980
/**
70-
* @var \Magento\Framework\UrlInterface
81+
* @var UrlInterface
7182
*/
7283
protected $urlBuilder;
7384

7485
/**
75-
* @param \Magento\Framework\Model\Context $context
76-
* @param \Magento\Framework\Registry $registry
77-
* @param \Magento\Backend\App\ConfigInterface $backendConfig
86+
* @param Context $context
87+
* @param Registry $registry
88+
* @param ConfigInterface $backendConfig
7889
* @param InboxFactory $inboxFactory
79-
* @param \Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory
80-
* @param \Magento\Framework\App\DeploymentConfig $deploymentConfig
81-
* @param \Magento\Framework\App\ProductMetadataInterface $productMetadata
82-
* @param \Magento\Framework\UrlInterface $urlBuilder
83-
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
84-
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
90+
* @param CurlFactory $curlFactory
91+
* @param DeploymentConfig $deploymentConfig
92+
* @param ProductMetadataInterface $productMetadata
93+
* @param UrlInterface $urlBuilder
94+
* @param AbstractResource|null $resource
95+
* @param AbstractDb|null $resourceCollection
8596
* @param array $data
8697
* @param Escaper|null $escaper
8798
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
8899
*/
89100
public function __construct(
90-
\Magento\Framework\Model\Context $context,
91-
\Magento\Framework\Registry $registry,
92-
\Magento\Backend\App\ConfigInterface $backendConfig,
93-
\Magento\AdminNotification\Model\InboxFactory $inboxFactory,
94-
\Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory,
95-
\Magento\Framework\App\DeploymentConfig $deploymentConfig,
96-
\Magento\Framework\App\ProductMetadataInterface $productMetadata,
97-
\Magento\Framework\UrlInterface $urlBuilder,
98-
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
99-
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
101+
Context $context,
102+
Registry $registry,
103+
ConfigInterface $backendConfig,
104+
InboxFactory $inboxFactory,
105+
CurlFactory $curlFactory,
106+
DeploymentConfig $deploymentConfig,
107+
ProductMetadataInterface $productMetadata,
108+
UrlInterface $urlBuilder,
109+
AbstractResource $resource = null,
110+
AbstractDb $resourceCollection = null,
100111
array $data = [],
101112
Escaper $escaper = null
102113
) {
@@ -210,10 +221,11 @@ public function setLastUpdate()
210221
/**
211222
* Retrieve feed data as XML element
212223
*
213-
* @return \SimpleXMLElement
224+
* @return SimpleXMLElement
214225
*/
215226
public function getFeedData()
216227
{
228+
/** @var Curl $curl */
217229
$curl = $this->curlFactory->create();
218230
$curl->setConfig(
219231
[
@@ -227,11 +239,11 @@ public function getFeedData()
227239
$curl->write(\Zend_Http_Client::GET, $this->getFeedUrl(), '1.0');
228240
$data = $curl->read();
229241
$data = preg_split('/^\r?$/m', $data, 2);
230-
$data = trim($data[1]);
242+
$data = trim($data[1] ?? '');
231243
$curl->close();
232244

233245
try {
234-
$xml = new \SimpleXMLElement($data);
246+
$xml = new SimpleXMLElement($data);
235247
} catch (\Exception $e) {
236248
return false;
237249
}
@@ -242,15 +254,15 @@ public function getFeedData()
242254
/**
243255
* Retrieve feed as XML element
244256
*
245-
* @return \SimpleXMLElement
257+
* @return SimpleXMLElement
246258
*/
247259
public function getFeedXml()
248260
{
249261
try {
250262
$data = $this->getFeedData();
251-
$xml = new \SimpleXMLElement($data);
263+
$xml = new SimpleXMLElement($data);
252264
} catch (\Exception $e) {
253-
$xml = new \SimpleXMLElement('<?xml version="1.0" encoding="utf-8" ?>');
265+
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8" ?>');
254266
}
255267

256268
return $xml;
@@ -259,10 +271,10 @@ public function getFeedXml()
259271
/**
260272
* Converts incoming data to string format and escapes special characters.
261273
*
262-
* @param \SimpleXMLElement $data
274+
* @param SimpleXMLElement $data
263275
* @return string
264276
*/
265-
private function escapeString(\SimpleXMLElement $data)
277+
private function escapeString(SimpleXMLElement $data)
266278
{
267279
return $this->escaper->escapeHtml((string)$data);
268280
}

app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
7-
/** @var $this \Magento\AdminNotification\Block\ToolbarEntry */
8-
6+
// phpcs:disable Generic.Files.LineLength
7+
/** @var $block \Magento\AdminNotification\Block\ToolbarEntry */
98
$notificationCount = $block->getUnreadNotificationCount();
109
$notificationCounterMax = $block->getNotificationCounterMax();
1110
?>
1211
<div
1312
data-mage-init='{"toolbarEntry": {}}'
1413
class="notifications-wrapper admin__action-dropdown-wrap"
1514
data-notification-count="<?= (int)$notificationCount ?>">
16-
<?php if ($notificationCount > 0) : ?>
15+
<?php if ($notificationCount > 0): ?>
1716
<a
1817
href="<?= $block->escapeUrl($block->getUrl('adminhtml/notification/index')) ?>"
1918
class="notifications-action admin__action-dropdown"
@@ -27,19 +26,19 @@
2726
<ul
2827
class="admin__action-dropdown-menu"
2928
data-mark-as-read-url="<?= $block->escapeUrl($block->getUrl('adminhtml/notification/ajaxMarkAsRead')) ?>">
30-
<?php foreach ($block->getLatestUnreadNotifications() as $notification) : ?>
29+
<?php foreach ($block->getLatestUnreadNotifications() as $notification): ?>
3130
<?php /** @var $notification \Magento\AdminNotification\Model\Inbox */ ?>
32-
<li class="notifications-entry<?php if ($notification->getSeverity() == 1) : ?> notifications-critical<?php endif; ?>"
31+
<li class="notifications-entry<?php if ($notification->getSeverity() == 1): ?> notifications-critical<?php endif; ?>"
3332
data-notification-id="<?= $block->escapeHtmlAttr($notification->getId()) ?>"
34-
data-notification-severity="<?php if ($notification->getSeverity() == 1) : ?>1<?php endif; ?>">
33+
data-notification-severity="<?php if ($notification->getSeverity() == 1): ?>1<?php endif; ?>">
3534
<?php
36-
$notificationDescription = $notification->getDescription();
35+
$notificationDescription = $notification->getDescription() ?? '';
3736
$notificationDescriptionLength = $block->getNotificationDescriptionLength();
3837
?>
3938
<strong class="notifications-entry-title">
4039
<?= $block->escapeHtml($notification->getTitle()) ?>
4140
</strong>
42-
<?php if (strlen($notificationDescription) > $notificationDescriptionLength) : ?>
41+
<?php if (strlen($notificationDescription) > $notificationDescriptionLength): ?>
4342
<p class="notifications-entry-description _cutted">
4443
<span class="notifications-entry-description-start">
4544
<?= $block->escapeHtml(substr($notificationDescription, 0, $notificationDescriptionLength)) ?>
@@ -48,7 +47,7 @@
4847
<?= $block->escapeHtml(substr($notificationDescription, $notificationDescriptionLength)) ?>
4948
</span>
5049
</p>
51-
<?php else : ?>
50+
<?php else: ?>
5251
<p class="notifications-entry-description">
5352
<?= $block->escapeHtml($notificationDescription) ?>
5453
</p>
@@ -71,7 +70,7 @@
7170
</a>
7271
</li>
7372
</ul>
74-
<?php else : ?>
73+
<?php else: ?>
7574
<a
7675
class="notifications-action admin__action-dropdown"
7776
href="<?= $block->escapeUrl($block->getUrl('adminhtml/notification/index')) ?>"

app/code/Magento/AdobeIms/Model/Config.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function getAuthUrl(): string
8181
return str_replace(
8282
['#{client_id}', '#{redirect_uri}', '#{locale}'],
8383
[$this->getApiKey(), $this->getCallBackUrl(), $this->getLocale()],
84-
$this->scopeConfig->getValue(self::XML_PATH_AUTH_URL_PATTERN)
84+
$this->scopeConfig->getValue(self::XML_PATH_AUTH_URL_PATTERN) ?? ''
8585
);
8686
}
8787

@@ -111,7 +111,7 @@ public function getLogoutUrl(string $accessToken, string $redirectUrl = '') : st
111111
return str_replace(
112112
['#{access_token}', '#{redirect_uri}'],
113113
[$accessToken, $redirectUrl],
114-
$this->scopeConfig->getValue(self::XML_PATH_LOGOUT_URL_PATTERN)
114+
$this->scopeConfig->getValue(self::XML_PATH_LOGOUT_URL_PATTERN) ?? ''
115115
);
116116
}
117117

@@ -123,7 +123,7 @@ public function getProfileImageUrl(): string
123123
return str_replace(
124124
['#{api_key}'],
125125
[$this->getApiKey()],
126-
$this->scopeConfig->getValue(self::XML_PATH_IMAGE_URL_PATTERN)
126+
$this->scopeConfig->getValue(self::XML_PATH_IMAGE_URL_PATTERN) ?? ''
127127
);
128128
}
129129
}

app/code/Magento/AdvancedSearch/Model/Recommendations/SaveSearchQueryRelationsObserver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function execute(EventObserver $observer)
3535
{
3636
$searchQueryModel = $observer->getEvent()->getDataObject();
3737
$queryId = $searchQueryModel->getId();
38-
$relatedQueries = $searchQueryModel->getSelectedQueriesGrid();
38+
$relatedQueries = $searchQueryModel->getSelectedQueriesGrid() ?? '';
3939

4040
if (strlen($relatedQueries) == 0) {
4141
$relatedQueries = [];

app/code/Magento/AdvancedSearch/Model/ResourceModel/Recommendations.php

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,37 @@
55
*/
66
namespace Magento\AdvancedSearch\Model\ResourceModel;
77

8+
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
9+
use Magento\Search\Model\Query;
10+
use Magento\Search\Model\QueryFactory;
11+
use Magento\Framework\Model\ResourceModel\Db\Context as DbContext;
12+
use Magento\Framework\DB\Select;
13+
use Zend_Db_Expr;
14+
815
/**
916
* Catalog search recommendations resource model
1017
*
1118
* @api
1219
* @since 100.0.2
1320
*/
14-
class Recommendations extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
21+
class Recommendations extends AbstractDb
1522
{
1623

1724
/**
18-
* Search query model
19-
*
20-
* @var \Magento\Search\Model\Query
25+
* @var Query
2126
*/
2227
protected $_searchQueryModel;
2328

2429
/**
2530
* Construct
2631
*
27-
* @param \Magento\Framework\Model\ResourceModel\Db\Context $context
28-
* @param \Magento\Search\Model\QueryFactory $queryFactory
32+
* @param DbContext $context
33+
* @param QueryFactory $queryFactory
2934
* @param string $connectionName
3035
*/
3136
public function __construct(
32-
\Magento\Framework\Model\ResourceModel\Db\Context $context,
33-
\Magento\Search\Model\QueryFactory $queryFactory,
37+
DbContext $context,
38+
QueryFactory $queryFactory,
3439
$connectionName = null
3540
) {
3641
parent::__construct($context, $connectionName);
@@ -107,7 +112,7 @@ public function getRelatedQueries($queryId, $limit = false, $order = false)
107112
['sr' => $collection->getTable('catalogsearch_recommendations')],
108113
'(sr.query_id=main_table.query_id OR sr.relation_id=main_table.query_id) AND ' . $queryIdCond
109114
)->reset(
110-
\Magento\Framework\DB\Select::COLUMNS
115+
Select::COLUMNS
111116
)->columns(
112117
[
113118
'rel_id' => $connection->getCheckSql(
@@ -180,7 +185,7 @@ protected function loadByQuery($query, $searchRecommendationsCount)
180185
}
181186

182187
$queryWords = [$query];
183-
if (strpos($query, ' ') !== false) {
188+
if ($query !== null && strpos($query, ' ') !== false) {
184189
$queryWords = array_unique(array_merge($queryWords, explode(' ', $query)));
185190
foreach ($queryWords as $key => $word) {
186191
$queryWords[$key] = trim($word);
@@ -200,7 +205,7 @@ protected function loadByQuery($query, $searchRecommendationsCount)
200205
$this->_searchQueryModel->getResource()->getMainTable(),
201206
['query_id']
202207
)->where(
203-
new \Zend_Db_Expr($likeCondition)
208+
new Zend_Db_Expr($likeCondition)
204209
)->where(
205210
'store_id=?',
206211
$this->_searchQueryModel->getStoreId()

app/code/Magento/AsynchronousOperations/Model/BulkManagement.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Magento\Framework\EntityManager\MetadataPool;
2121
use Magento\Framework\MessageQueue\BulkPublisherInterface;
2222
use Psr\Log\LoggerInterface;
23+
use Throwable;
2324

2425
/**
2526
* Asynchronous Bulk Management
@@ -160,7 +161,7 @@ public function retryBulk($bulkUuid, array $errorCodes)
160161
$operation = reset($retriablyFailedOperations);
161162
//async consumer expects operations to be in the database
162163
// thus such operation should not be deleted but reopened
163-
$shouldReopen = strpos($operation->getTopicName(), ConfigInterface::TOPIC_PREFIX) === 0;
164+
$shouldReopen = strpos($operation->getTopicName() ?? '', ConfigInterface::TOPIC_PREFIX) === 0;
164165
$metadata = $this->metadataPool->getMetadata(OperationInterface::class);
165166
$linkField = $metadata->getLinkField();
166167
$ids = [];
@@ -199,7 +200,7 @@ public function retryBulk($bulkUuid, array $errorCodes)
199200
}
200201
}
201202
$connection->commit();
202-
} catch (\Throwable $exception) {
203+
} catch (Throwable $exception) {
203204
$connection->rollBack();
204205
$this->logger->critical($exception->getMessage());
205206
$affectedOperations = 0;

0 commit comments

Comments
 (0)