Skip to content

Commit c930f86

Browse files
author
Stanislav Idolov
authored
ENGCOM-2640: [Forwardport] Code cleanup of lib files #17329
2 parents d4e92fc + 58a9786 commit c930f86

Some content is hidden

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

49 files changed

+68
-86
lines changed

lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function getCustomAttribute($attributeCode)
7676
*/
7777
public function getCustomAttributes()
7878
{
79-
return isset($this->_data[self::CUSTOM_ATTRIBUTES]) ? $this->_data[self::CUSTOM_ATTRIBUTES] : [];
79+
return $this->_data[self::CUSTOM_ATTRIBUTES] ?? [];
8080
}
8181

8282
/**
@@ -131,7 +131,7 @@ public function setCustomAttribute($attributeCode, $attributeValue)
131131
*/
132132
protected function getCustomAttributesCodes()
133133
{
134-
return isset($this->customAttributesCodes) ? $this->customAttributesCodes : [];
134+
return $this->customAttributesCodes ?? [];
135135
}
136136

137137
/**

lib/internal/Magento/Framework/Api/AbstractSimpleObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(array $data = [])
3434
*/
3535
protected function _get($key)
3636
{
37-
return isset($this->_data[$key]) ? $this->_data[$key] : null;
37+
return $this->_data[$key] ?? null;
3838
}
3939

4040
/**

lib/internal/Magento/Framework/Api/ImageProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public function processImageContent($entityType, $imageContent)
172172
*/
173173
protected function getMimeTypeExtension($mimeType)
174174
{
175-
return isset($this->mimeTypeExtensionMap[$mimeType]) ? $this->mimeTypeExtensionMap[$mimeType] : '';
175+
return $this->mimeTypeExtensionMap[$mimeType] ?? '';
176176
}
177177

178178
/**

lib/internal/Magento/Framework/Api/Search/Document.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ public function setId($id)
3333
*/
3434
public function getCustomAttribute($attributeCode)
3535
{
36-
return isset($this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode])
37-
? $this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode]
38-
: null;
36+
return $this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode] ?? null;
3937
}
4038

4139
/**

lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,6 @@ private function getCustomFilterForField($field)
123123
*/
124124
private function getFieldMapping($field)
125125
{
126-
return isset($this->fieldMapping[$field]) ? $this->fieldMapping[$field] : $field;
126+
return $this->fieldMapping[$field] ?? $field;
127127
}
128128
}

lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,6 @@ private function getCustomJoin($field)
121121
*/
122122
private function getFieldMapping($field)
123123
{
124-
return isset($this->fieldMapping[$field]) ? $this->fieldMapping[$field] : $field;
124+
return $this->fieldMapping[$field] ?? $field;
125125
}
126126
}

lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/SortingProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function process(SearchCriteriaInterface $searchCriteria, AbstractDb $col
5959
*/
6060
private function getFieldMapping($field)
6161
{
62-
return isset($this->fieldMapping[$field]) ? $this->fieldMapping[$field] : $field;
62+
return $this->fieldMapping[$field] ?? $field;
6363
}
6464

6565
/**

lib/internal/Magento/Framework/App/ActionFlag.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ public function get($action, $flag = '')
6565
$action = $this->_request->getActionName();
6666
}
6767
if ('' === $flag) {
68-
return isset(
69-
$this->_flags[$this->_getControllerKey()]
70-
) ? $this->_flags[$this->_getControllerKey()] : [];
68+
return $this->_flags[$this->_getControllerKey()] ?? [];
7169
} elseif (isset($this->_flags[$this->_getControllerKey()][$action][$flag])) {
7270
return $this->_flags[$this->_getControllerKey()][$action][$flag];
7371
} else {

lib/internal/Magento/Framework/App/AreaList.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function getCodeByFrontName($frontName)
8888
*/
8989
public function getFrontName($areaCode)
9090
{
91-
return isset($this->_areas[$areaCode]['frontName']) ? $this->_areas[$areaCode]['frontName'] : null;
91+
return $this->_areas[$areaCode]['frontName'] ?? null;
9292
}
9393

9494
/**
@@ -111,7 +111,7 @@ public function getCodes()
111111
*/
112112
public function getDefaultRouter($areaCode)
113113
{
114-
return isset($this->_areas[$areaCode]['router']) ? $this->_areas[$areaCode]['router'] : null;
114+
return $this->_areas[$areaCode]['router'] ?? null;
115115
}
116116

117117
/**

lib/internal/Magento/Framework/App/Config/Initial.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ public function getData($scope)
7272
list($scopeType, $scopeCode) = array_pad(explode('|', $scope), 2, null);
7373

7474
if (ScopeConfigInterface::SCOPE_TYPE_DEFAULT == $scopeType) {
75-
return isset($this->_data[$scopeType]) ? $this->_data[$scopeType] : [];
75+
return $this->_data[$scopeType] ?? [];
7676
} elseif ($scopeCode) {
77-
return isset($this->_data[$scopeType][$scopeCode]) ? $this->_data[$scopeType][$scopeCode] : [];
77+
return $this->_data[$scopeType][$scopeCode] ?? [];
7878
}
7979
return [];
8080
}

0 commit comments

Comments
 (0)