Skip to content

Commit 4dfb6da

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.4-develop
Accepted Community Pull Requests: - #26772: Clean up 'isset' coding style (by @GraysonChiang) - #25858: FIX #25856 / Group Ordered Products report by SKU (by @lbajsarowicz) Fixed GitHub Issues: - #25856: Ordered Products Report not grouping by configurable products variations (reported by @lgrassini) has been fixed in #25858 by @lbajsarowicz in 2.4-develop branch Related commits: 1. 840cec9 2. 5fb9d49 3. ffa3d2e 4. 40311e9 5. db02013
2 parents 3d87b92 + fa7ef72 commit 4dfb6da

File tree

58 files changed

+470
-160
lines changed

Some content is hidden

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

58 files changed

+470
-160
lines changed

app/code/Magento/Bundle/Helper/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ public function getAllowedSelectionTypes()
3838
{
3939
$configData = $this->config->getType(\Magento\Catalog\Model\Product\Type::TYPE_BUNDLE);
4040

41-
return isset($configData['allowed_selection_types']) ? $configData['allowed_selection_types'] : [];
41+
return $configData['allowed_selection_types'] ?? [];
4242
}
4343
}

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public function getCustomerGroups($groupId = null)
212212
}
213213

214214
if ($groupId !== null) {
215-
return isset($this->_customerGroups[$groupId]) ? $this->_customerGroups[$groupId] : [];
215+
return $this->_customerGroups[$groupId] ?? [];
216216
}
217217

218218
return $this->_customerGroups;

app/code/Magento/Catalog/Model/Product/Attribute/Source/Status.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ public function getVisibleStatusIds()
3737
}
3838

3939
/**
40-
* Retrieve Saleable Status Ids
41-
* Default Product Enable status
40+
* Retrieve Saleable Status Ids, default Product Enable status
4241
*
4342
* @return int[]
4443
*/
@@ -51,6 +50,7 @@ public function getSaleableStatusIds()
5150
* Retrieve option array
5251
*
5352
* @return string[]
53+
* phpcs:disable Magento2.Functions.StaticFunction
5454
*/
5555
public static function getOptionArray()
5656
{
@@ -83,7 +83,7 @@ public function getOptionText($optionId)
8383
{
8484
$options = self::getOptionArray();
8585

86-
return isset($options[$optionId]) ? $options[$optionId] : null;
86+
return $options[$optionId] ?? null;
8787
}
8888

8989
/**

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

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

1010
use Magento\Catalog\Model\Product;
1111

12+
/**
13+
* Manage entryes
14+
*/
1215
class EntryResolver
1316
{
1417
/**
@@ -27,7 +30,7 @@ public function getEntryFilePathById(Product $product, $entryId)
2730

2831
foreach ($mediaGalleryData['images'] as $image) {
2932
if (isset($image['value_id']) && $image['value_id'] == $entryId) {
30-
return isset($image['file']) ? $image['file'] : null;
33+
return $image['file'] ?? null;
3134
}
3235
}
3336
return null;
@@ -49,7 +52,7 @@ public function getEntryIdByFilePath(Product $product, $filePath)
4952

5053
foreach ($mediaGalleryData['images'] as $image) {
5154
if (isset($image['file']) && $image['file'] == $filePath) {
52-
return isset($image['value_id']) ? $image['value_id'] : null;
55+
return $image['value_id'] ?? null;
5356
}
5457
}
5558
return null;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public static function getAllOptions()
133133
public static function getOptionText($optionId)
134134
{
135135
$options = self::getOptionArray();
136-
return isset($options[$optionId]) ? $options[$optionId] : null;
136+
return $options[$optionId] ?? null;
137137
}
138138
//phpcs:enable Magento2.Functions.StaticFunction
139139

app/code/Magento/Catalog/Model/ProductLink/Converter/ConverterPool.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace Magento\Catalog\Model\ProductLink\Converter;
88

9+
/**
10+
* Return converter by link type
11+
*/
912
class ConverterPool
1013
{
1114
/**
@@ -34,8 +37,6 @@ public function __construct(array $converters)
3437
*/
3538
public function getConverter($linkType)
3639
{
37-
return isset($this->converters[$linkType])
38-
? $this->converters[$linkType]
39-
: $this->converters[$this->defaultConverterCode];
40+
return $this->converters[$linkType] ?? $this->converters[$this->defaultConverterCode];
4041
}
4142
}

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
namespace Magento\Catalog\Model\ProductLink;
88

99
/**
10+
* @inheritdoc
11+
*
1012
* @codeCoverageIgnore
1113
*/
1214
class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements
@@ -30,17 +32,19 @@ class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements
3032
*/
3133
protected function _get($key)
3234
{
33-
return isset($this->_data[$key]) ? $this->_data[$key] : null;
35+
return $this->_data[$key] ?? null;
3436
}
3537

3638
/**
3739
* Return Data Object data in array format.
3840
*
3941
* @return array
4042
* @todo refactor with converter for AbstractExtensibleModel
43+
* phpcs:disable
4144
*/
4245
public function __toArray()
4346
{
47+
//phpcs:enable
4448
$data = $this->_data;
4549
$hasToArray = function ($model) {
4650
return is_object($model) && method_exists($model, '__toArray') && is_callable([$model, '__toArray']);
@@ -169,7 +173,7 @@ public function setPosition($position)
169173
}
170174

171175
/**
172-
* {@inheritdoc}
176+
* @inheritdoc
173177
*
174178
* @return \Magento\Catalog\Api\Data\ProductLinkExtensionInterface|null
175179
*/
@@ -184,7 +188,7 @@ public function getExtensionAttributes()
184188
}
185189

186190
/**
187-
* {@inheritdoc}
191+
* @inheritdoc
188192
*
189193
* @param \Magento\Catalog\Api\Data\ProductLinkExtensionInterface $extensionAttributes
190194
* @return $this

app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ protected function getMultilineFieldConfig($attributeCode, array $attributeConfi
289289
'dataScope' => $lineIndex,
290290
'provider' => $providerName,
291291
'validation' => $isFirstLine
292+
//phpcs:ignore Magento2.Performance.ForeachArrayMerge
292293
? array_merge(
293294
['required-entry' => (bool)$attributeConfig['required']],
294295
$attributeConfig['validation']
@@ -381,14 +382,14 @@ protected function getCustomer(): ?CustomerInterface
381382
/**
382383
* Retrieve field options from attribute configuration
383384
*
384-
* @param string $attributeCode
385+
* @param mixed $attributeCode
385386
* @param array $attributeConfig
386387
* @return array
387388
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
388389
*/
389390
protected function getFieldOptions($attributeCode, array $attributeConfig)
390391
{
391-
return isset($attributeConfig['options']) ? $attributeConfig['options'] : [];
392+
return $attributeConfig['options'] ?? [];
392393
}
393394

394395
/**

app/code/Magento/Config/Model/Config/Structure/AbstractElement.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function getData()
103103
*/
104104
public function getId()
105105
{
106-
return isset($this->_data['id']) ? $this->_data['id'] : '';
106+
return $this->_data['id'] ?? '';
107107
}
108108

109109
/**
@@ -133,7 +133,7 @@ public function getComment()
133133
*/
134134
public function getFrontendModel()
135135
{
136-
return isset($this->_data['frontend_model']) ? $this->_data['frontend_model'] : '';
136+
return $this->_data['frontend_model'] ?? '';
137137
}
138138

139139
/**
@@ -194,7 +194,7 @@ protected function _hasVisibilityValue($key)
194194
*/
195195
public function getClass()
196196
{
197-
return isset($this->_data['class']) ? $this->_data['class'] : '';
197+
return $this->_data['class'] ?? '';
198198
}
199199

200200
/**

app/code/Magento/Config/Model/Config/Structure/Element/Field.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function getTooltip()
150150
*/
151151
public function getType()
152152
{
153-
return isset($this->_data['type']) ? $this->_data['type'] : 'text';
153+
return $this->_data['type'] ?? 'text';
154154
}
155155

156156
/**
@@ -204,7 +204,7 @@ public function getRequiredFields($fieldPrefix = '')
204204
*/
205205
public function getFrontendClass()
206206
{
207-
return isset($this->_data['frontend_class']) ? $this->_data['frontend_class'] : '';
207+
return $this->_data['frontend_class'] ?? '';
208208
}
209209

210210
/**
@@ -256,7 +256,7 @@ public function getGroupPath()
256256
*/
257257
public function getConfigPath()
258258
{
259-
return isset($this->_data['config_path']) ? $this->_data['config_path'] : null;
259+
return $this->_data['config_path'] ?? null;
260260
}
261261

262262
/**
@@ -334,7 +334,7 @@ public function hasValidation()
334334
*/
335335
public function getValidation()
336336
{
337-
return isset($this->_data['validate']) ? $this->_data['validate'] : null;
337+
return $this->_data['validate'] ?? null;
338338
}
339339

340340
/**

0 commit comments

Comments
 (0)