Skip to content

Commit 323676f

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.4-develop latest changes
Accepted Community Pull Requests: - #30167: Set correct discount package value for tablerate (by @basvanpoppel) - #30320: Fix #11175 - i18n:collect-phrases -m can't find many important magento phrases (by @Bartlomiejsz) - #27574: Fix wrong position of button list when load "New Attribute" page (by @edenduong) - #30002: Use one format in all places for array_merge (by @ihor-sviziev) - #30023: Fix URL generation for new store when it created with setup:config:import (by @ihor-sviziev) - #27454: Add missing order_data array to EmailSender classes (by @kassner) Fixed GitHub Issues: - #30169: [Issue] Set correct discount package value for tablerate (reported by @m2-assistant[bot]) has been fixed in #30167 by @basvanpoppel in 2.4-develop branch Related commits: 1. 5ce73ab 2. 29a60c5 3. d3fc301 4. 6c11aeb 5. 2602b9f 6. 09d13b8 7. 460252f 8. 353097e 9. 997ab12 10. 88f63a6 11. 43fb133 12. af06eab - #11175: i18n:collect-phrases -m can't find many important magento phrases (reported by @scholtz) has been fixed in #30320 by @Bartlomiejsz in 2.4-develop branch Related commits: 1. 48216f3 - #29597: [Issue] Fix wrong position of button list when load "New Attribute" page (reported by @m2-assistant[bot]) has been fixed in #27574 by @edenduong in 2.4-develop branch Related commits: 1. 59dd0db 2. 1dd4e1b 3. 037e4c5 - #30005: [Issue] Use one format in all places for array_merge (reported by @m2-assistant[bot]) has been fixed in #30002 by @ihor-sviziev in 2.4-develop branch Related commits: 1. a2b9380 2. f6c4cbd 3. 7f9c334 - #30025: [Issue] Fix URL generation for new store when it created with setup:config:import (reported by @m2-assistant[bot]) has been fixed in #30023 by @ihor-sviziev in 2.4-develop branch Related commits: 1. 075ddb4 - #29604: [Issue] Add missing order_data array to EmailSender classes (reported by @m2-assistant[bot]) has been fixed in #27454 by @kassner in 2.4-develop branch Related commits: 1. 1000822 2. 56f8bf8 3. 145d189
2 parents bc8e51d + 240805e commit 323676f

File tree

85 files changed

+541
-233
lines changed

Some content is hidden

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

85 files changed

+541
-233
lines changed

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php

+14-10
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public function __construct(
4242
}
4343

4444
/**
45+
* Construct block
46+
*
4547
* @return void
4648
*/
4749
protected function _construct()
@@ -51,6 +53,14 @@ protected function _construct()
5153

5254
parent::_construct();
5355

56+
$this->buttonList->update('save', 'label', __('Save Attribute'));
57+
$this->buttonList->update('save', 'class', 'save primary');
58+
$this->buttonList->update(
59+
'save',
60+
'data_attribute',
61+
['mage-init' => ['button' => ['event' => 'save', 'target' => '#edit_form']]]
62+
);
63+
5464
if ($this->getRequest()->getParam('popup')) {
5565
$this->buttonList->remove('back');
5666
if ($this->getRequest()->getParam('product_tab') != 'variations') {
@@ -64,6 +74,8 @@ protected function _construct()
6474
100
6575
);
6676
}
77+
$this->buttonList->update('reset', 'level', 10);
78+
$this->buttonList->update('save', 'class', 'save action-secondary');
6779
} else {
6880
$this->addButton(
6981
'save_and_edit_button',
@@ -79,14 +91,6 @@ protected function _construct()
7991
);
8092
}
8193

82-
$this->buttonList->update('save', 'label', __('Save Attribute'));
83-
$this->buttonList->update('save', 'class', 'save primary');
84-
$this->buttonList->update(
85-
'save',
86-
'data_attribute',
87-
['mage-init' => ['button' => ['event' => 'save', 'target' => '#edit_form']]]
88-
);
89-
9094
$entityAttribute = $this->_coreRegistry->registry('entity_attribute');
9195
if (!$entityAttribute || !$entityAttribute->getIsUserDefined()) {
9296
$this->buttonList->remove('delete');
@@ -96,14 +100,14 @@ protected function _construct()
96100
}
97101

98102
/**
99-
* {@inheritdoc}
103+
* @inheritdoc
100104
*/
101105
public function addButton($buttonId, $data, $level = 0, $sortOrder = 0, $region = 'toolbar')
102106
{
103107
if ($this->getRequest()->getParam('popup')) {
104108
$region = 'header';
105109
}
106-
parent::addButton($buttonId, $data, $level, $sortOrder, $region);
110+
return parent::addButton($buttonId, $data, $level, $sortOrder, $region);
107111
}
108112

109113
/**

app/code/Magento/Catalog/Block/Product/ListProduct.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ public function getIdentities()
367367
$identities[] = $item->getIdentities();
368368
}
369369
}
370-
$identities = array_merge(...$identities);
370+
$identities = array_merge([], ...$identities);
371371

372372
return $identities;
373373
}

app/code/Magento/Catalog/Block/Product/ProductList/Related.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ public function getItems()
143143
*/
144144
public function getIdentities()
145145
{
146-
$identities = [[]];
146+
$identities = [];
147147
foreach ($this->getItems() as $item) {
148148
$identities[] = $item->getIdentities();
149149
}
150-
return array_merge(...$identities);
150+
return array_merge([], ...$identities);
151151
}
152152

153153
/**

app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,10 @@ public function getItemLimit($type = '')
267267
*/
268268
public function getIdentities()
269269
{
270-
$identities = array_map(function (DataObject $item) {
271-
return $item->getIdentities();
272-
}, $this->getItems()) ?: [[]];
273-
274-
return array_merge(...$identities);
270+
$identities = [];
271+
foreach ($this->getItems() as $item) {
272+
$identities[] = $item->getIdentities();
273+
}
274+
return array_merge([], ...$identities);
275275
}
276276
}

app/code/Magento/Catalog/Model/Indexer/Product/Category/Action/Rows.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,14 @@ private function getCategoryIdsFromIndex(array $productIds): array
270270
);
271271
$categoryIds[] = $storeCategories;
272272
}
273-
$categoryIds = array_merge(...$categoryIds);
273+
$categoryIds = array_merge([], ...$categoryIds);
274274

275275
$parentCategories = [$categoryIds];
276276
foreach ($categoryIds as $categoryId) {
277277
$parentIds = explode('/', $this->getPathFromCategoryId($categoryId));
278278
$parentCategories[] = $parentIds;
279279
}
280-
$categoryIds = array_unique(array_merge(...$parentCategories));
280+
$categoryIds = array_unique(array_merge([], ...$parentCategories));
281281

282282
return $categoryIds;
283283
}

app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ protected function _fillTemporaryFlatTable(array $tables, $storeId, $valueFieldS
261261

262262
$select->from(
263263
['et' => $entityTemporaryTableName],
264-
array_merge(...$allColumns)
264+
array_merge([], ...$allColumns)
265265
)->joinInner(
266266
['e' => $this->resource->getTableName('catalog_product_entity')],
267267
'e.entity_id = et.entity_id',
@@ -306,7 +306,7 @@ protected function _fillTemporaryFlatTable(array $tables, $storeId, $valueFieldS
306306
$allColumns[] = $columnValueNames;
307307
}
308308
}
309-
$sql = $select->insertFromSelect($temporaryFlatTableName, array_merge(...$allColumns), false);
309+
$sql = $select->insertFromSelect($temporaryFlatTableName, array_merge([], ...$allColumns), false);
310310
$this->_connection->query($sql);
311311
}
312312

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -836,10 +836,7 @@ public function getStoreIds()
836836
$storeIds[] = $websiteStores;
837837
}
838838
}
839-
if ($storeIds) {
840-
$storeIds = array_merge(...$storeIds);
841-
}
842-
$this->setStoreIds($storeIds);
839+
$this->setStoreIds(array_merge([], ...$storeIds));
843840
}
844841
return $this->getData('store_ids');
845842
}

app/code/Magento/Catalog/Model/Product/Price/TierPriceStorage.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
use Magento\Catalog\Model\Product\Price\Validation\TierPriceValidator;
1313
use Magento\Catalog\Model\ProductIdLocatorInterface;
1414

15-
/**
16-
* Tier price storage.
17-
*/
1815
class TierPriceStorage implements TierPriceStorageInterface
1916
{
2017
/**
@@ -220,7 +217,7 @@ private function retrieveAffectedIds(array $skus): array
220217
$affectedIds[] = array_keys($productId);
221218
}
222219

223-
return $affectedIds ? array_unique(array_merge(...$affectedIds)) : [];
220+
return array_unique(array_merge([], ...$affectedIds));
224221
}
225222

226223
/**

app/code/Magento/Catalog/Model/ProductLink/ProductLinkQuery.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private function extractRequestedLinkTypes(array $criteria): array
103103
if (count($linkTypesToLoad) === 1) {
104104
$linkTypesToLoad = $linkTypesToLoad[0];
105105
} else {
106-
$linkTypesToLoad = array_merge(...$linkTypesToLoad);
106+
$linkTypesToLoad = array_merge([], ...$linkTypesToLoad);
107107
}
108108
$linkTypesToLoad = array_flip($linkTypesToLoad);
109109
$linkTypes = array_filter(

app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderComposite.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function build(int $productId, int $storeId) : array
3333
foreach ($this->linkedProductSelectBuilder as $productSelectBuilder) {
3434
$selects[] = $productSelectBuilder->build($productId, $storeId);
3535
}
36-
$selects = array_merge(...$selects);
36+
$selects = array_merge([], ...$selects);
3737

3838
return $selects;
3939
}

app/code/Magento/CatalogGraphQl/DataProvider/Product/LayeredNavigation/Builder/Attribute.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ function (AggregationValueInterface $value) {
155155
return [];
156156
}
157157

158-
return $this->attributeOptionProvider->getOptions(\array_merge(...$attributeOptionIds), $storeId, $attributes);
158+
return $this->attributeOptionProvider->getOptions(
159+
\array_merge([], ...$attributeOptionIds),
160+
$storeId,
161+
$attributes
162+
);
159163
}
160164
}

app/code/Magento/CatalogGraphQl/DataProvider/Product/LayeredNavigation/LayerBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function build(AggregationInterface $aggregation, ?int $storeId): array
3636
foreach ($this->builders as $builder) {
3737
$layers[] = $builder->build($aggregation, $storeId);
3838
}
39-
$layers = \array_merge(...$layers);
39+
$layers = \array_merge([], ...$layers);
4040

4141
return \array_filter($layers);
4242
}

app/code/Magento/CatalogGraphQl/Model/AttributesJoiner.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function getQueryFields(FieldNode $fieldNode, ResolveInfo $resolveInfo):
8888
}
8989
}
9090
if ($fragmentFields) {
91-
$selectedFields = array_merge($selectedFields, array_merge(...$fragmentFields));
91+
$selectedFields = array_merge([], $selectedFields, ...$fragmentFields);
9292
}
9393
$this->setSelectionsForFieldNode($fieldNode, array_unique($selectedFields));
9494
}

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/SearchCriteria/CollectionProcessor/FilterProcessor/CategoryFilter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function apply(Filter $filter, AbstractDb $collection)
6464
$collection->addCategoryFilter($category);
6565
}
6666

67-
$categoryProductIds = array_unique(array_merge(...$categoryProducts));
67+
$categoryProductIds = array_unique(array_merge([], ...$categoryProducts));
6868
$collection->addIdFilter($categoryProductIds);
6969
return true;
7070
}

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ protected function processChildren(
169169

170170
$requiredChildrenIds = $typeInstance->getChildrenIds($productId, true);
171171
if ($requiredChildrenIds) {
172-
$childrenIds = [[]];
172+
$childrenIds = [];
173173
foreach ($requiredChildrenIds as $groupedChildrenIds) {
174174
$childrenIds[] = $groupedChildrenIds;
175175
}
176-
$childrenIds = array_merge(...$childrenIds);
176+
$childrenIds = array_merge([], ...$childrenIds);
177177

178178
$childrenWebsites = $this->productWebsite->getWebsites($childrenIds);
179179
foreach ($websitesWithStores as $websiteId => $storeId) {
@@ -232,13 +232,13 @@ protected function getWebsitesWithDefaultStores($websiteId = null)
232232
*/
233233
protected function processParents($productId, $websiteId)
234234
{
235-
$parentIds = [[]];
235+
$parentIds = [];
236236
foreach ($this->getProductTypeInstances() as $typeInstance) {
237237
/* @var ProductType\AbstractType $typeInstance */
238238
$parentIds[] = $typeInstance->getParentIdsByChild($productId);
239239
}
240240

241-
$parentIds = array_merge(...$parentIds);
241+
$parentIds = array_merge([], ...$parentIds);
242242

243243
if (empty($parentIds)) {
244244
return;

app/code/Magento/CatalogSearch/Model/Layer/Filter/Attribute.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function apply(\Magento\Framework\App\RequestInterface $request)
7070
$label = $this->getOptionText($value);
7171
$labels[] = is_array($label) ? $label : [$label];
7272
}
73-
$label = implode(',', array_unique(array_merge(...$labels)));
73+
$label = implode(',', array_unique(array_merge([], ...$labels)));
7474
$this->getLayer()
7575
->getState()
7676
->addFilter($this->_createItem($label, $attributeValue));

app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Store/Group.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function afterSave(
121121
*/
122122
protected function generateProductUrls($websiteId, $originWebsiteId)
123123
{
124-
$urls = [[]];
124+
$urls = [];
125125
$websiteIds = $websiteId != $originWebsiteId
126126
? [$websiteId, $originWebsiteId]
127127
: [$websiteId];
@@ -136,7 +136,7 @@ protected function generateProductUrls($websiteId, $originWebsiteId)
136136
$urls[] = $this->productUrlRewriteGenerator->generate($product);
137137
}
138138

139-
return array_merge(...$urls);
139+
return array_merge([], ...$urls);
140140
}
141141

142142
/**
@@ -148,7 +148,7 @@ protected function generateProductUrls($websiteId, $originWebsiteId)
148148
*/
149149
protected function generateCategoryUrls($rootCategoryId, $storeIds)
150150
{
151-
$urls = [[]];
151+
$urls = [];
152152
$categories = $this->categoryFactory->create()->getCategories($rootCategoryId, 1, false, true);
153153
foreach ($categories as $category) {
154154
/** @var \Magento\Catalog\Model\Category $category */
@@ -157,6 +157,6 @@ protected function generateCategoryUrls($rootCategoryId, $storeIds)
157157
$urls[] = $this->categoryUrlRewriteGenerator->generate($category);
158158
}
159159

160-
return array_merge(...$urls);
160+
return array_merge([], ...$urls);
161161
}
162162
}

app/code/Magento/CatalogUrlRewrite/Observer/AfterImportDataObserver.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737
use RuntimeException;
3838

3939
/**
40-
* Class AfterImportDataObserver
41-
*
4240
* @SuppressWarnings(PHPMD.TooManyFields)
4341
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
4442
*/
@@ -459,8 +457,7 @@ private function categoriesUrlRewriteGenerate(): array
459457
}
460458
}
461459
}
462-
$result = !empty($urls) ? array_merge(...$urls) : [];
463-
return $result;
460+
return array_merge([], ...$urls);
464461
}
465462

466463
/**

app/code/Magento/CatalogWidget/Block/Product/ProductsList.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -510,15 +510,15 @@ public function getPagerHtml()
510510
*/
511511
public function getIdentities()
512512
{
513-
$identities = [[]];
513+
$identities = [];
514514
if ($this->getProductCollection()) {
515515
foreach ($this->getProductCollection() as $product) {
516516
if ($product instanceof IdentityInterface) {
517517
$identities[] = $product->getIdentities();
518518
}
519519
}
520520
}
521-
$identities = array_merge(...$identities);
521+
$identities = array_merge([], ...$identities);
522522

523523
return $identities ?: [Product::CACHE_TAG];
524524
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ public function __construct($list = null)
3535
public function isValid($agreementIds = [])
3636
{
3737
$agreementIds = $agreementIds === null ? [] : $agreementIds;
38-
$requiredAgreements = [[]];
38+
$requiredAgreements = [];
3939
foreach ($this->agreementsProviders as $agreementsProvider) {
4040
$requiredAgreements[] = $agreementsProvider->getRequiredAgreementIds();
4141
}
4242

43-
$agreementsDiff = array_diff(array_merge(...$requiredAgreements), $agreementIds);
43+
$agreementsDiff = array_diff(array_merge([], ...$requiredAgreements), $agreementIds);
4444

4545
return empty($agreementsDiff);
4646
}

app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ $filters = $block->getConfig()->getFilters() ?? [];
1111
$allowedExtensions = [];
1212
$blockHtmlId = $block->getHtmlId();
1313

14-
$listExtensions = [[]];
14+
$listExtensions = [];
1515
foreach ($filters as $media_type) {
1616
$listExtensions[] = array_map(function ($fileExt) {
1717
return ltrim($fileExt, '.*');
1818
}, $media_type['files']);
1919
}
2020

21-
$allowedExtensions = array_merge(...$listExtensions);
21+
$allowedExtensions = array_merge([], ...$listExtensions);
2222

2323
$resizeConfig = $block->getImageUploadConfigData()->getIsResizeEnabled()
2424
? "{action: 'resize', maxWidth: "

app/code/Magento/Csp/Helper/InlineUtil.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,14 @@ private function extractHost(string $url): ?string
110110
*/
111111
private function extractRemoteFonts(string $styleContent): array
112112
{
113-
$urlsFound = [[]];
113+
$urlsFound = [];
114114
preg_match_all('/\@font\-face\s*?\{([^\}]*)[^\}]*?\}/im', $styleContent, $fontFaces);
115115
foreach ($fontFaces[1] as $fontFaceContent) {
116116
preg_match_all('/url\([\'\"]?(http(s)?\:[^\)]+)[\'\"]?\)/i', $fontFaceContent, $urls);
117117
$urlsFound[] = $urls[1];
118118
}
119119

120-
return array_map([$this, 'extractHost'], array_merge(...$urlsFound));
120+
return array_map([$this, 'extractHost'], array_merge([], ...$urlsFound));
121121
}
122122

123123
/**

0 commit comments

Comments
 (0)