Skip to content

Commit 180f896

Browse files
committed
fix the isset code style
1 parent 4b78d9a commit 180f896

File tree

51 files changed

+81
-103
lines changed

Some content is hidden

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

51 files changed

+81
-103
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function getEntryFilePathById(Product $product, $entryId)
2727

2828
foreach ($mediaGalleryData['images'] as $image) {
2929
if (isset($image['value_id']) && $image['value_id'] == $entryId) {
30-
return isset($image['file']) ? $image['file'] : null;
30+
return $image['file'] ?? null;
3131
}
3232
}
3333
return null;
@@ -49,7 +49,7 @@ public function getEntryIdByFilePath(Product $product, $filePath)
4949

5050
foreach ($mediaGalleryData['images'] as $image) {
5151
if (isset($image['file']) && $image['file'] == $filePath) {
52-
return isset($image['value_id']) ? $image['value_id'] : null;
52+
return $image['value_id'] ?? null;
5353
}
5454
}
5555
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: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ public function __construct(array $converters)
3434
*/
3535
public function getConverter($linkType)
3636
{
37-
return isset($this->converters[$linkType])
38-
? $this->converters[$linkType]
39-
: $this->converters[$this->defaultConverterCode];
37+
return $this->converters[$linkType] ?? $this->converters[$this->defaultConverterCode];
4038
}
4139
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements
3030
*/
3131
protected function _get($key)
3232
{
33-
return isset($this->_data[$key]) ? $this->_data[$key] : null;
33+
return $this->_data[$key] ?? null;
3434
}
3535

3636
/**

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ protected function getFieldConfig(
197197
? $additionalConfig['sortOrder']
198198
: $attributeConfig['sortOrder'],
199199
'validation' => $this->mergeConfigurationNode('validation', $additionalConfig, $attributeConfig),
200-
'options' => $this->getFieldOptions($attributeCode, $attributeConfig),
200+
'options' => $this->getFieldOptions($attributeConfig),
201201
'filterBy' => isset($additionalConfig['filterBy']) ? $additionalConfig['filterBy'] : null,
202202
'customEntry' => isset($additionalConfig['customEntry']) ? $additionalConfig['customEntry'] : null,
203203
'visible' => isset($additionalConfig['visible']) ? $additionalConfig['visible'] : true,
@@ -381,14 +381,13 @@ protected function getCustomer(): ?CustomerInterface
381381
/**
382382
* Retrieve field options from attribute configuration
383383
*
384-
* @param string $attributeCode
385384
* @param array $attributeConfig
386385
* @return array
387386
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
388387
*/
389-
protected function getFieldOptions($attributeCode, array $attributeConfig)
388+
protected function getFieldOptions(array $attributeConfig)
390389
{
391-
return isset($attributeConfig['options']) ? $attributeConfig['options'] : [];
390+
return $attributeConfig['options'] ?? [];
392391
}
393392

394393
/**

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)