Skip to content

Commit 101cf07

Browse files
committed
Merge branch '2.4-develop' into ACP2E-3897
2 parents 482d2be + f39080e commit 101cf07

File tree

24 files changed

+705
-224
lines changed

24 files changed

+705
-224
lines changed

app/code/Magento/Catalog/Model/FrontendStorageConfigurationPool.php

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright 2017 Adobe
44
* All Rights Reserved.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Catalog\Model;
89

@@ -17,18 +18,12 @@
1718
*/
1819
class FrontendStorageConfigurationPool
1920
{
20-
/**
21-
* @var array
22-
*/
23-
private $storageConfigurations;
24-
2521
/**
2622
* StorageConfigurationPool constructor.
2723
* @param array $storageConfigurations
2824
*/
29-
public function __construct(array $storageConfigurations = [])
25+
public function __construct(private array $storageConfigurations = [])
3026
{
31-
$this->storageConfigurations = $storageConfigurations;
3227
}
3328

3429
/**
@@ -40,16 +35,16 @@ public function __construct(array $storageConfigurations = [])
4035
*/
4136
public function get($namespace)
4237
{
43-
if (isset($this->storageConfigurations[$namespace])) {
44-
if (!$this->storageConfigurations[$namespace] instanceof FrontendStorageConfigurationInterface) {
45-
throw new LocalizedException(
46-
__(sprintf("Invalid pool type with namespace: %s", $namespace))
47-
);
48-
}
49-
} else {
38+
$storageConfiguration = $this->storageConfigurations[$namespace] ?? null;
39+
if ($storageConfiguration === null) {
5040
return false;
5141
}
42+
if (!$storageConfiguration instanceof FrontendStorageConfigurationInterface) {
43+
throw new LocalizedException(
44+
__("Invalid pool type with namespace: %1", $namespace)
45+
);
46+
}
5247

53-
return $this->storageConfigurations[$namespace];
48+
return $storageConfiguration;
5449
}
5550
}

app/code/Magento/CatalogInventory/Model/StockStateProvider.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright 2014 Adobe
44
* All Rights Reserved.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\CatalogInventory\Model;
89

@@ -169,13 +170,13 @@ public function checkQuoteItemQty(StockItemInterface $stockItem, $qty, $summaryQ
169170
if (!$this->checkQty($stockItem, $summaryQty) || !$this->checkQty($stockItem, $qty)) {
170171
$message = __('The requested qty. is not available');
171172
if ((int) $this->scopeConfig->getValue('cataloginventory/options/not_available_message') === 1) {
172-
$itemMessage = (__(sprintf(
173-
'Only %s of %s available',
173+
$itemMessage = __(
174+
'Only %1 of %2 available',
174175
$stockItem->getQty() - $stockItem->getMinQty(),
175176
$this->localeFormat->getNumber($qty)
176-
)));
177+
);
177178
} else {
178-
$itemMessage = (__('Not enough items for sale'));
179+
$itemMessage = __('Not enough items for sale');
179180
}
180181
$result->setHasError(true)
181182
->setErrorCode('qty_available')

app/code/Magento/CheckoutAgreements/Model/Agreement.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@
99

1010
class Agreement extends \Magento\Framework\Model\AbstractExtensibleModel implements AgreementInterface
1111
{
12+
/**
13+
* @var string
14+
*/
15+
protected $_eventPrefix = 'checkout_agreement';
16+
17+
/**
18+
* @var string
19+
*/
20+
protected $_eventObject = 'agreement';
21+
1222
/**
1323
* Allowed CSS units for height field
1424
*
@@ -17,6 +27,8 @@ class Agreement extends \Magento\Framework\Model\AbstractExtensibleModel impleme
1727
protected $allowedCssUnits = ['px', 'pc', 'pt', 'ex', 'em', 'mm', 'cm', 'in', '%'];
1828

1929
/**
30+
* Agreement constructor
31+
*
2032
* @return void
2133
* @codeCoverageIgnore
2234
*/
@@ -26,6 +38,8 @@ protected function _construct()
2638
}
2739

2840
/**
41+
* Validate agreement data
42+
*
2943
* @param \Magento\Framework\DataObject $agreementData
3044
* @return array|bool
3145
*/
@@ -195,7 +209,7 @@ public function setMode($mode)
195209
}
196210

197211
/**
198-
* {@inheritdoc}
212+
* @inheritdoc
199213
*
200214
* @return \Magento\CheckoutAgreements\Api\Data\AgreementExtensionInterface|null
201215
*/
@@ -205,7 +219,7 @@ public function getExtensionAttributes()
205219
}
206220

207221
/**
208-
* {@inheritdoc}
222+
* @inheritdoc
209223
*
210224
* @param \Magento\CheckoutAgreements\Api\Data\AgreementExtensionInterface $extensionAttributes
211225
* @return $this

app/code/Magento/Cms/Ui/Component/Listing/Column/BlockActions.php

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,19 @@ class BlockActions extends Column
4040
* @param UrlInterface $urlBuilder
4141
* @param array $components
4242
* @param array $data
43+
* @param Escaper|null $escaper
4344
*/
4445
public function __construct(
4546
ContextInterface $context,
4647
UiComponentFactory $uiComponentFactory,
4748
UrlInterface $urlBuilder,
4849
array $components = [],
49-
array $data = []
50+
array $data = [],
51+
?Escaper $escaper = null
5052
) {
5153
$this->urlBuilder = $urlBuilder;
5254
parent::__construct($context, $uiComponentFactory, $components, $data);
55+
$this->escaper = $escaper ?: ObjectManager::getInstance()->get(Escaper::class);
5356
}
5457

5558
/**
@@ -60,7 +63,7 @@ public function prepareDataSource(array $dataSource)
6063
if (isset($dataSource['data']['items'])) {
6164
foreach ($dataSource['data']['items'] as & $item) {
6265
if (isset($item['block_id'])) {
63-
$title = $this->getEscaper()->escapeHtmlAttr($item['title']);
66+
$title = $this->escaper->escapeHtmlAttr($item['title']);
6467
$item[$this->getData('name')] = [
6568
'edit' => [
6669
'href' => $this->urlBuilder->getUrl(
@@ -92,19 +95,4 @@ public function prepareDataSource(array $dataSource)
9295

9396
return $dataSource;
9497
}
95-
96-
/**
97-
* Get instance of escaper
98-
*
99-
* @return Escaper
100-
* @deprecated 101.0.7
101-
*/
102-
private function getEscaper()
103-
{
104-
if (!$this->escaper) {
105-
// phpcs:ignore Magento2.PHP.AutogeneratedClassNotInConstructor
106-
$this->escaper = ObjectManager::getInstance()->get(Escaper::class);
107-
}
108-
return $this->escaper;
109-
}
11098
}

app/code/Magento/Cms/Ui/Component/Listing/Column/PageActions.php

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
class PageActions extends Column
2020
{
2121
/** Url path */
22-
const CMS_URL_PATH_EDIT = 'cms/page/edit';
23-
const CMS_URL_PATH_DELETE = 'cms/page/delete';
22+
public const CMS_URL_PATH_EDIT = 'cms/page/edit';
23+
public const CMS_URL_PATH_DELETE = 'cms/page/delete';
2424

2525
/**
2626
* @var \Magento\Cms\Block\Adminhtml\Page\Grid\Renderer\Action\UrlBuilder
@@ -56,6 +56,7 @@ class PageActions extends Column
5656
* @param array $data
5757
* @param string $editUrl
5858
* @param \Magento\Cms\ViewModel\Page\Grid\UrlBuilder|null $scopeUrlBuilder
59+
* @param Escaper|null $escaper
5960
*/
6061
public function __construct(
6162
ContextInterface $context,
@@ -65,14 +66,16 @@ public function __construct(
6566
array $components = [],
6667
array $data = [],
6768
$editUrl = self::CMS_URL_PATH_EDIT,
68-
?\Magento\Cms\ViewModel\Page\Grid\UrlBuilder $scopeUrlBuilder = null
69+
?\Magento\Cms\ViewModel\Page\Grid\UrlBuilder $scopeUrlBuilder = null,
70+
?Escaper $escaper = null
6971
) {
7072
$this->urlBuilder = $urlBuilder;
7173
$this->actionUrlBuilder = $actionUrlBuilder;
7274
$this->editUrl = $editUrl;
7375
parent::__construct($context, $uiComponentFactory, $components, $data);
7476
$this->scopeUrlBuilder = $scopeUrlBuilder ?: ObjectManager::getInstance()
7577
->get(\Magento\Cms\ViewModel\Page\Grid\UrlBuilder::class);
78+
$this->escaper = $escaper ?: ObjectManager::getInstance()->get(Escaper::class);
7679
}
7780

7881
/**
@@ -88,7 +91,7 @@ public function prepareDataSource(array $dataSource)
8891
'href' => $this->urlBuilder->getUrl($this->editUrl, ['page_id' => $item['page_id']]),
8992
'label' => __('Edit'),
9093
];
91-
$title = $this->getEscaper()->escapeHtml($item['title']);
94+
$title = $this->escaper->escapeHtml($item['title']);
9295
$item[$name]['delete'] = [
9396
'href' => $this->urlBuilder->getUrl(self::CMS_URL_PATH_DELETE, ['page_id' => $item['page_id']]),
9497
'label' => __('Delete'),
@@ -115,18 +118,4 @@ public function prepareDataSource(array $dataSource)
115118

116119
return $dataSource;
117120
}
118-
119-
/**
120-
* Get instance of escaper
121-
*
122-
* @return Escaper
123-
* @deprecated 101.0.7
124-
*/
125-
private function getEscaper()
126-
{
127-
if (!$this->escaper) {
128-
$this->escaper = ObjectManager::getInstance()->get(Escaper::class);
129-
}
130-
return $this->escaper;
131-
}
132121
}

app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2011 Adobe
4+
* All Rights Reserved.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\ConfigurableImportExport\Model\Import\Product\Type;
89

@@ -59,7 +60,7 @@ class Configurable extends \Magento\CatalogImportExport\Model\Import\Product\Typ
5960
self::ERROR_INVALID_OPTION_VALUE => 'Column configurable_variations: Invalid option value for attribute "%s"',
6061
self::ERROR_INVALID_WEBSITE => 'Invalid website code for super attribute',
6162
self::ERROR_DUPLICATED_VARIATIONS => 'SKU %s contains duplicated variations',
62-
self::ERROR_UNIDENTIFIABLE_VARIATION => 'Configurable variation "%s" is unidentifiable',
63+
self::ERROR_UNIDENTIFIABLE_VARIATION => 'Configurable variation "%1" is unidentifiable',
6364
];
6465

6566
/**
@@ -580,10 +581,8 @@ protected function _parseVariations($rowData)
580581
if (empty($fieldAndValuePairs['sku'])) {
581582
throw new LocalizedException(
582583
__(
583-
sprintf(
584-
$this->_messageTemplates[self::ERROR_UNIDENTIFIABLE_VARIATION],
585-
$variation
586-
)
584+
$this->_messageTemplates[self::ERROR_UNIDENTIFIABLE_VARIATION],
585+
$variation
587586
)
588587
);
589588
}

app/code/Magento/Eav/Model/AttributeManagement.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2014 Adobe
4+
* All Rights Reserved.
55
*/
66

77
namespace Magento\Eav\Model;
@@ -92,7 +92,7 @@ public function __construct(
9292
}
9393

9494
/**
95-
* {@inheritdoc}
95+
* @inheritdoc
9696
*/
9797
public function assign($entityTypeCode, $attributeSetId, $attributeGroupId, $attributeCode, $sortOrder)
9898
{
@@ -134,7 +134,7 @@ public function assign($entityTypeCode, $attributeSetId, $attributeGroupId, $att
134134
}
135135

136136
/**
137-
* {@inheritdoc}
137+
* @inheritdoc
138138
*/
139139
public function unassign($attributeSetId, $attributeCode)
140140
{
@@ -171,13 +171,13 @@ public function unassign($attributeSetId, $attributeCode)
171171
}
172172

173173
/**
174-
* {@inheritdoc}
174+
* @inheritdoc
175175
*/
176-
public function getAttributes($entityType, $attributeSetId)
176+
public function getAttributes($entityTypeCode, $attributeSetId)
177177
{
178178
/** @var \Magento\Eav\Api\Data\AttributeSetInterface $attributeSet */
179179
$attributeSet = $this->setRepository->get($attributeSetId);
180-
$requiredEntityTypeId = $this->eavConfig->getEntityType($entityType)->getId();
180+
$requiredEntityTypeId = $this->eavConfig->getEntityType($entityTypeCode)->getId();
181181
if (!$attributeSet->getAttributeSetId() || $attributeSet->getEntityTypeId() != $requiredEntityTypeId) {
182182
throw NoSuchEntityException::singleField('attributeSetId', $attributeSetId);
183183
}

app/code/Magento/EavGraphQl/Model/GetAttributeSelectedOptionComposite.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2023 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -39,9 +39,7 @@ public function __construct(array $providers = [])
3939
public function execute(string $entityType, array $customAttribute): ?array
4040
{
4141
if (!isset($this->providers[$entityType])) {
42-
throw new RuntimeException(
43-
__(sprintf('"%s" entity type not set in providers', $entityType))
44-
);
42+
throw new RuntimeException(__('"%1" entity type not set in providers', $entityType));
4543
}
4644
if (!$this->providers[$entityType] instanceof GetAttributeSelectedOptionInterface) {
4745
throw new RuntimeException(

app/code/Magento/EavGraphQl/Model/GetAttributeValueComposite.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2023 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -39,9 +39,7 @@ public function __construct(array $providers = [])
3939
public function execute(string $entityType, array $customAttribute): ?array
4040
{
4141
if (!isset($this->providers[$entityType])) {
42-
throw new RuntimeException(
43-
__(sprintf('"%s" entity type not set in providers', $entityType))
44-
);
42+
throw new RuntimeException(__('"%1" entity type not set in providers', $entityType));
4543
}
4644
if (!$this->providers[$entityType] instanceof GetAttributeValueInterface) {
4745
throw new RuntimeException(

0 commit comments

Comments
 (0)