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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Magento\Config\Model\Config\Structure\Element;
77

88
/**
9-
* Section
9+
* Element section
1010
*
1111
* @api
1212
* @since 100.0.2
@@ -43,7 +43,7 @@ public function __construct(
4343
*/
4444
public function getHeaderCss()
4545
{
46-
return isset($this->_data['header_css']) ? $this->_data['header_css'] : '';
46+
return $this->_data['header_css'] ?? '';
4747
}
4848

4949
/**

app/code/Magento/Customer/Ui/Component/ColumnFactory.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ protected function getJsComponent($dataType)
130130
*/
131131
protected function getDataType($frontendType)
132132
{
133-
return isset($this->dataTypeMap[$frontendType])
134-
? $this->dataTypeMap[$frontendType]
135-
: $this->dataTypeMap['default'];
133+
return $this->dataTypeMap[$frontendType] ?? $this->dataTypeMap['default'];
136134
}
137135
}

app/code/Magento/Customer/Ui/Component/FilterFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,6 @@ public function create(array $attributeData, $context)
7676
*/
7777
protected function getFilterType($frontendInput)
7878
{
79-
return isset($this->filterMap[$frontendInput]) ? $this->filterMap[$frontendInput] : $this->filterMap['default'];
79+
return $this->filterMap[$frontendInput] ?? $this->filterMap['default'];
8080
}
8181
}

app/code/Magento/Customer/Ui/Component/Listing/AttributeRepository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Magento\Customer\Model\Indexer\Attribute\Filter;
1515

1616
/**
17-
* Class AttributeRepository
17+
* Attribute Repository Managment
1818
*/
1919
class AttributeRepository
2020
{
@@ -156,10 +156,10 @@ protected function getOptionArray(array $options)
156156
* Return customer group's metadata by given group code
157157
*
158158
* @param string $code
159-
* @return []
159+
* @return array | null
160160
*/
161161
public function getMetadataByCode($code)
162162
{
163-
return isset($this->getList()[$code]) ? $this->getList()[$code] : null;
163+
return $this->getList()[$code] ?? null;
164164
}
165165
}

app/code/Magento/Customer/Ui/Component/Listing/Column/ValidationRules.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ public function getValidationRules($isRequired, $validationRules)
6363
protected function getValidationClass(ValidationRuleInterface $rule)
6464
{
6565
$key = $rule->getName() == 'input_validation' ? $rule->getValue() : $rule->getName();
66-
return isset($this->inputValidationMap[$key])
67-
? $this->inputValidationMap[$key]
68-
: $key;
66+
return $this->inputValidationMap[$key] ?? $key;
6967
}
7068

7169
/**

app/code/Magento/Customer/Ui/Component/Listing/Columns.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
use Magento\Customer\Ui\Component\Listing\Column\InlineEditUpdater;
1313
use Magento\Customer\Api\CustomerMetadataInterface;
1414

15+
/**
16+
* Columns component
17+
*/
1518
class Columns extends \Magento\Ui\Component\Listing\Columns
1619
{
1720
/**
@@ -29,6 +32,11 @@ class Columns extends \Magento\Ui\Component\Listing\Columns
2932
*/
3033
protected $inlineEditUpdater;
3134

35+
/**
36+
* @var ColumnFactory
37+
*/
38+
private $columnFactory;
39+
3240
/**
3341
* @var array
3442
*/
@@ -63,6 +71,8 @@ public function __construct(
6371
}
6472

6573
/**
74+
* Return default sort order
75+
*
6676
* @return int
6777
*/
6878
protected function getDefaultSortOrder()
@@ -94,7 +104,7 @@ protected function updateActionColumnSortOrder()
94104
}
95105

96106
/**
97-
* {@inheritdoc}
107+
* @inheritdoc
98108
*/
99109
public function prepare()
100110
{
@@ -113,6 +123,8 @@ public function prepare()
113123
}
114124

115125
/**
126+
* Add column to the component
127+
*
116128
* @param array $attributeData
117129
* @param string $columnName
118130
* @return void
@@ -129,6 +141,8 @@ public function addColumn(array $attributeData, $columnName)
129141
}
130142

131143
/**
144+
* Update column in component
145+
*
132146
* @param array $attributeData
133147
* @param string $newAttributeCode
134148
* @return void
@@ -200,6 +214,6 @@ public function addOptions(UiComponentInterface $component, array $attributeData
200214
*/
201215
protected function getFilterType($frontendInput)
202216
{
203-
return isset($this->filterMap[$frontendInput]) ? $this->filterMap[$frontendInput] : $this->filterMap['default'];
217+
return $this->filterMap[$frontendInput] ?? $this->filterMap['default'];
204218
}
205219
}

app/code/Magento/Deploy/Model/Mode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function enableDefaultMode()
205205
public function getMode()
206206
{
207207
$env = $this->reader->load();
208-
return isset($env[State::PARAM_MODE]) ? $env[State::PARAM_MODE] : null;
208+
return $env[State::PARAM_MODE] ?? null;
209209
}
210210

211211
/**

app/code/Magento/Deploy/Package/Package.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public function isVirtual()
219219
*/
220220
public function getParam($name)
221221
{
222-
return isset($this->params[$name]) ? $this->params[$name] : null;
222+
return $this->params[$name] ?? null;
223223
}
224224

225225
/**
@@ -253,7 +253,7 @@ public function getThemeModel()
253253
*/
254254
public function getFile($fileId)
255255
{
256-
return isset($this->files[$fileId]) ? $this->files[$fileId] : false;
256+
return $this->files[$fileId] ?? false;
257257
}
258258

259259
/**

0 commit comments

Comments
 (0)