diff --git a/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php b/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php index 3ea43cbccd24f..99dd972dc26ea 100644 --- a/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php +++ b/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php @@ -74,7 +74,7 @@ public function getCustomAttribute($attributeCode) */ public function getCustomAttributes() { - return isset($this->_data[self::CUSTOM_ATTRIBUTES]) ? $this->_data[self::CUSTOM_ATTRIBUTES] : []; + return $this->_data[self::CUSTOM_ATTRIBUTES] ?? []; } /** @@ -129,7 +129,7 @@ public function setCustomAttribute($attributeCode, $attributeValue) */ protected function getCustomAttributesCodes() { - return isset($this->customAttributesCodes) ? $this->customAttributesCodes : []; + return $this->customAttributesCodes ?? []; } /** diff --git a/lib/internal/Magento/Framework/Api/AbstractSimpleObject.php b/lib/internal/Magento/Framework/Api/AbstractSimpleObject.php index b907246139d42..9cc0ddab3bfcb 100644 --- a/lib/internal/Magento/Framework/Api/AbstractSimpleObject.php +++ b/lib/internal/Magento/Framework/Api/AbstractSimpleObject.php @@ -34,7 +34,7 @@ public function __construct(array $data = []) */ protected function _get($key) { - return isset($this->_data[$key]) ? $this->_data[$key] : null; + return $this->_data[$key] ?? null; } /** diff --git a/lib/internal/Magento/Framework/Api/ImageProcessor.php b/lib/internal/Magento/Framework/Api/ImageProcessor.php index e2c5f8c4083b9..4642a742576df 100644 --- a/lib/internal/Magento/Framework/Api/ImageProcessor.php +++ b/lib/internal/Magento/Framework/Api/ImageProcessor.php @@ -172,7 +172,7 @@ public function processImageContent($entityType, $imageContent) */ protected function getMimeTypeExtension($mimeType) { - return isset($this->mimeTypeExtensionMap[$mimeType]) ? $this->mimeTypeExtensionMap[$mimeType] : ''; + return $this->mimeTypeExtensionMap[$mimeType] ?? ''; } /** diff --git a/lib/internal/Magento/Framework/Api/Search/Document.php b/lib/internal/Magento/Framework/Api/Search/Document.php index d60458a6e5585..7454fa7974ece 100644 --- a/lib/internal/Magento/Framework/Api/Search/Document.php +++ b/lib/internal/Magento/Framework/Api/Search/Document.php @@ -33,9 +33,7 @@ public function setId($id) */ public function getCustomAttribute($attributeCode) { - return isset($this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode]) - ? $this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode] - : null; + return $this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode] ?? null; } /** diff --git a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor.php b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor.php index b663a3a2f733c..e127dfd4b1624 100644 --- a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor.php +++ b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/FilterProcessor.php @@ -114,6 +114,6 @@ private function getCustomFilterForField($field) */ private function getFieldMapping($field) { - return isset($this->fieldMapping[$field]) ? $this->fieldMapping[$field] : $field; + return $this->fieldMapping[$field] ?? $field; } } diff --git a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor.php b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor.php index b8e52334bee1f..207325042c737 100644 --- a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor.php +++ b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/JoinProcessor.php @@ -121,6 +121,6 @@ private function getCustomJoin($field) */ private function getFieldMapping($field) { - return isset($this->fieldMapping[$field]) ? $this->fieldMapping[$field] : $field; + return $this->fieldMapping[$field] ?? $field; } } diff --git a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/SortingProcessor.php b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/SortingProcessor.php index 7598c4eb4abdc..9c18b8c1a9ae5 100644 --- a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/SortingProcessor.php +++ b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/SortingProcessor.php @@ -59,7 +59,7 @@ public function process(SearchCriteriaInterface $searchCriteria, AbstractDb $col */ private function getFieldMapping($field) { - return isset($this->fieldMapping[$field]) ? $this->fieldMapping[$field] : $field; + return $this->fieldMapping[$field] ?? $field; } /** diff --git a/lib/internal/Magento/Framework/App/ActionFlag.php b/lib/internal/Magento/Framework/App/ActionFlag.php index 657c2ede9262d..55201504c968f 100644 --- a/lib/internal/Magento/Framework/App/ActionFlag.php +++ b/lib/internal/Magento/Framework/App/ActionFlag.php @@ -65,9 +65,7 @@ public function get($action, $flag = '') $action = $this->_request->getActionName(); } if ('' === $flag) { - return isset( - $this->_flags[$this->_getControllerKey()] - ) ? $this->_flags[$this->_getControllerKey()] : []; + return $this->_flags[$this->_getControllerKey()] ?? []; } elseif (isset($this->_flags[$this->_getControllerKey()][$action][$flag])) { return $this->_flags[$this->_getControllerKey()][$action][$flag]; } else { diff --git a/lib/internal/Magento/Framework/App/AreaList.php b/lib/internal/Magento/Framework/App/AreaList.php index 7c123f7ff9d60..fb28d09d5fe09 100644 --- a/lib/internal/Magento/Framework/App/AreaList.php +++ b/lib/internal/Magento/Framework/App/AreaList.php @@ -88,7 +88,7 @@ public function getCodeByFrontName($frontName) */ public function getFrontName($areaCode) { - return isset($this->_areas[$areaCode]['frontName']) ? $this->_areas[$areaCode]['frontName'] : null; + return $this->_areas[$areaCode]['frontName'] ?? null; } /** @@ -111,7 +111,7 @@ public function getCodes() */ public function getDefaultRouter($areaCode) { - return isset($this->_areas[$areaCode]['router']) ? $this->_areas[$areaCode]['router'] : null; + return $this->_areas[$areaCode]['router'] ?? null; } /** diff --git a/lib/internal/Magento/Framework/App/Config/Initial.php b/lib/internal/Magento/Framework/App/Config/Initial.php index 1933682346ad3..b65c9a2f53489 100644 --- a/lib/internal/Magento/Framework/App/Config/Initial.php +++ b/lib/internal/Magento/Framework/App/Config/Initial.php @@ -72,9 +72,9 @@ public function getData($scope) list($scopeType, $scopeCode) = array_pad(explode('|', $scope), 2, null); if (ScopeConfigInterface::SCOPE_TYPE_DEFAULT == $scopeType) { - return isset($this->_data[$scopeType]) ? $this->_data[$scopeType] : []; + return $this->_data[$scopeType] ?? []; } elseif ($scopeCode) { - return isset($this->_data[$scopeType][$scopeCode]) ? $this->_data[$scopeType][$scopeCode] : []; + return $this->_data[$scopeType][$scopeCode] ?? []; } return []; } diff --git a/lib/internal/Magento/Framework/App/DefaultPath/DefaultPath.php b/lib/internal/Magento/Framework/App/DefaultPath/DefaultPath.php index 61d0aa138f9a4..8a4188aed9605 100644 --- a/lib/internal/Magento/Framework/App/DefaultPath/DefaultPath.php +++ b/lib/internal/Magento/Framework/App/DefaultPath/DefaultPath.php @@ -32,6 +32,6 @@ public function __construct(array $parts) */ public function getPart($code) { - return isset($this->_parts[$code]) ? $this->_parts[$code] : null; + return $this->_parts[$code] ?? null; } } diff --git a/lib/internal/Magento/Framework/App/DeploymentConfig.php b/lib/internal/Magento/Framework/App/DeploymentConfig.php index 92bb3fdbbc54f..615c295675adc 100644 --- a/lib/internal/Magento/Framework/App/DeploymentConfig.php +++ b/lib/internal/Magento/Framework/App/DeploymentConfig.php @@ -70,7 +70,7 @@ public function get($key = null, $defaultValue = null) if ($key === null) { return $this->flatData; } - return isset($this->flatData[$key]) ? $this->flatData[$key] : $defaultValue; + return $this->flatData[$key] ?? $defaultValue; } /** diff --git a/lib/internal/Magento/Framework/App/Http/Context.php b/lib/internal/Magento/Framework/App/Http/Context.php index a5eba2753b510..79a15110234cd 100644 --- a/lib/internal/Magento/Framework/App/Http/Context.php +++ b/lib/internal/Magento/Framework/App/Http/Context.php @@ -84,9 +84,7 @@ public function unsValue($name) */ public function getValue($name) { - return isset($this->data[$name]) - ? $this->data[$name] - : (isset($this->default[$name]) ? $this->default[$name] : null); + return $this->data[$name] ?? ($this->default[$name] ?? null); } /** diff --git a/lib/internal/Magento/Framework/Component/ComponentRegistrar.php b/lib/internal/Magento/Framework/Component/ComponentRegistrar.php index 9c746177d6f7d..88b2995179d4d 100644 --- a/lib/internal/Magento/Framework/Component/ComponentRegistrar.php +++ b/lib/internal/Magento/Framework/Component/ComponentRegistrar.php @@ -68,7 +68,7 @@ public function getPaths($type) public function getPath($type, $componentName) { self::validateType($type); - return isset(self::$paths[$type][$componentName]) ? self::$paths[$type][$componentName] : null; + return self::$paths[$type][$componentName] ?? null; } /** diff --git a/lib/internal/Magento/Framework/Config/View.php b/lib/internal/Magento/Framework/Config/View.php index ef9c39e221e86..05863caeec2b6 100644 --- a/lib/internal/Magento/Framework/Config/View.php +++ b/lib/internal/Magento/Framework/Config/View.php @@ -71,7 +71,7 @@ public function __construct( public function getVars($module) { $this->initData(); - return isset($this->data['vars'][$module]) ? $this->data['vars'][$module] : []; + return $this->data['vars'][$module] ?? []; } /** @@ -110,7 +110,7 @@ public function getVarValue($module, $var) public function getMediaEntities($module, $mediaType) { $this->initData(); - return isset($this->data['media'][$module][$mediaType]) ? $this->data['media'][$module][$mediaType] : []; + return $this->data['media'][$module][$mediaType] ?? []; } /** @@ -124,9 +124,7 @@ public function getMediaEntities($module, $mediaType) public function getMediaAttributes($module, $mediaType, $mediaId) { $this->initData(); - return isset($this->data['media'][$module][$mediaType][$mediaId]) - ? $this->data['media'][$module][$mediaType][$mediaId] - : []; + return $this->data['media'][$module][$mediaType][$mediaId] ?? []; } /** @@ -163,7 +161,7 @@ protected function getIdAttributes() public function getExcludedFiles() { $items = $this->getItems(); - return isset($items['file']) ? $items['file'] : []; + return $items['file'] ?? []; } /** @@ -174,7 +172,7 @@ public function getExcludedFiles() public function getExcludedDir() { $items = $this->getItems(); - return isset($items['directory']) ? $items['directory'] : []; + return $items['directory'] ?? []; } /** @@ -185,7 +183,7 @@ public function getExcludedDir() protected function getItems() { $this->initData(); - return isset($this->data['exclude']) ? $this->data['exclude'] : []; + return $this->data['exclude'] ?? []; } /** diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php index 2274fde82b818..1449d6d2a6456 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php @@ -483,7 +483,7 @@ public function rawFetchRow($sql, $field = null) if (empty($field)) { return $row; } else { - return isset($row[$field]) ? $row[$field] : false; + return $row[$field] ?? false; } } diff --git a/lib/internal/Magento/Framework/Data/AbstractCriteria.php b/lib/internal/Magento/Framework/Data/AbstractCriteria.php index c90ed2b03bf3d..d4811b79980a9 100644 --- a/lib/internal/Magento/Framework/Data/AbstractCriteria.php +++ b/lib/internal/Magento/Framework/Data/AbstractCriteria.php @@ -274,7 +274,7 @@ public function getLimit() */ public function getPart($name, $default = null) { - return isset($this->data[$name]) ? $this->data[$name] : $default; + return $this->data[$name] ?? $default; } /** diff --git a/lib/internal/Magento/Framework/Data/AbstractDataObject.php b/lib/internal/Magento/Framework/Data/AbstractDataObject.php index 5916100ffbbfa..da04fecc447cc 100644 --- a/lib/internal/Magento/Framework/Data/AbstractDataObject.php +++ b/lib/internal/Magento/Framework/Data/AbstractDataObject.php @@ -50,6 +50,6 @@ public function toArray() */ protected function get($key) { - return isset($this->data[$key]) ? $this->data[$key] : null; + return $this->data[$key] ?? null; } } diff --git a/lib/internal/Magento/Framework/Data/Collection.php b/lib/internal/Magento/Framework/Data/Collection.php index f8b82d3122234..71ec8c1aa8379 100644 --- a/lib/internal/Magento/Framework/Data/Collection.php +++ b/lib/internal/Magento/Framework/Data/Collection.php @@ -851,7 +851,7 @@ public function count() */ public function getFlag($flag) { - return isset($this->_flags[$flag]) ? $this->_flags[$flag] : null; + return $this->_flags[$flag] ?? null; } /** diff --git a/lib/internal/Magento/Framework/Data/Structure.php b/lib/internal/Magento/Framework/Data/Structure.php index 9d540e8a49f08..a977d3448ec26 100644 --- a/lib/internal/Magento/Framework/Data/Structure.php +++ b/lib/internal/Magento/Framework/Data/Structure.php @@ -166,7 +166,7 @@ public function createElement($elementId, array $data) */ public function getElement($elementId) { - return isset($this->_elements[$elementId]) ? $this->_elements[$elementId] : false; + return $this->_elements[$elementId] ?? false; } /** @@ -456,9 +456,7 @@ public function getChildId($parentId, $alias) */ public function getChildren($parentId) { - return isset( - $this->_elements[$parentId][self::CHILDREN] - ) ? $this->_elements[$parentId][self::CHILDREN] : []; + return $this->_elements[$parentId][self::CHILDREN] ?? []; } /** @@ -469,7 +467,7 @@ public function getChildren($parentId) */ public function getParentId($childId) { - return isset($this->_elements[$childId][self::PARENT]) ? $this->_elements[$childId][self::PARENT] : false; + return $this->_elements[$childId][self::PARENT] ?? false; } /** diff --git a/lib/internal/Magento/Framework/Event.php b/lib/internal/Magento/Framework/Event.php index 4c116d0a33629..c7b15a8eb0722 100644 --- a/lib/internal/Magento/Framework/Event.php +++ b/lib/internal/Magento/Framework/Event.php @@ -88,7 +88,7 @@ public function dispatch() */ public function getName() { - return isset($this->_data['name']) ? $this->_data['name'] : null; + return $this->_data['name'] ?? null; } /** diff --git a/lib/internal/Magento/Framework/Filesystem/Io/File.php b/lib/internal/Magento/Framework/Filesystem/Io/File.php index 60a94d5b430e9..2e724260ff543 100644 --- a/lib/internal/Magento/Framework/Filesystem/Io/File.php +++ b/lib/internal/Magento/Framework/Filesystem/Io/File.php @@ -228,7 +228,7 @@ public function streamStat($part = null, $default = null) } $stat = @fstat($this->_streamHandler); if ($part !== null) { - return isset($stat[$part]) ? $stat[$part] : $default; + return $stat[$part] ?? $default; } return $stat; } diff --git a/lib/internal/Magento/Framework/Filter/AbstractFactory.php b/lib/internal/Magento/Framework/Filter/AbstractFactory.php index 2a0ae0ba15e42..c30b07aa09061 100644 --- a/lib/internal/Magento/Framework/Filter/AbstractFactory.php +++ b/lib/internal/Magento/Framework/Filter/AbstractFactory.php @@ -68,7 +68,7 @@ public function canCreateFilter($alias) */ public function isShared($class) { - return isset($this->shared[$class]) ? $this->shared[$class] : $this->shareByDefault; + return $this->shared[$class] ?? $this->shareByDefault; } /** diff --git a/lib/internal/Magento/Framework/Filter/Input.php b/lib/internal/Magento/Framework/Filter/Input.php index 39c7a54786edb..6da748fcbeb9f 100644 --- a/lib/internal/Magento/Framework/Filter/Input.php +++ b/lib/internal/Magento/Framework/Filter/Input.php @@ -183,7 +183,7 @@ public function getFilters($name = null) if (null === $name) { return $this->_filters; } else { - return isset($this->_filters[$name]) ? $this->_filters[$name] : null; + return $this->_filters[$name] ?? null; } } diff --git a/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php b/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php index 489755a2846fc..718b08190d8be 100644 --- a/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php +++ b/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php @@ -268,7 +268,7 @@ public function getNext($type, $method, $code = '__self') $this->_inheritPlugins($type); } $key = $type . '_' . lcfirst($method) . '_' . $code; - return isset($this->_processed[$key]) ? $this->_processed[$key] : null; + return $this->_processed[$key] ?? null; } /** diff --git a/lib/internal/Magento/Framework/Message/Collection.php b/lib/internal/Magento/Framework/Message/Collection.php index fb8351c5a04ba..b1e3088a703f7 100644 --- a/lib/internal/Magento/Framework/Message/Collection.php +++ b/lib/internal/Magento/Framework/Message/Collection.php @@ -142,7 +142,7 @@ public function getItems() */ public function getItemsByType($type) { - return isset($this->messages[$type]) ? $this->messages[$type] : []; + return $this->messages[$type] ?? []; } /** diff --git a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php index db919c80e251c..5963f5f942374 100644 --- a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php +++ b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php @@ -151,9 +151,7 @@ public function getCustomAttributes() public function getCustomAttribute($attributeCode) { $this->initializeCustomAttributes(); - return isset($this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode]) - ? $this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode] - : null; + return $this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode] ?? null; } /** diff --git a/lib/internal/Magento/Framework/Module/FullModuleList.php b/lib/internal/Magento/Framework/Module/FullModuleList.php index 5ad5b05a413ef..c6e403dee0898 100644 --- a/lib/internal/Magento/Framework/Module/FullModuleList.php +++ b/lib/internal/Magento/Framework/Module/FullModuleList.php @@ -55,7 +55,7 @@ public function getAll() public function getOne($name) { $data = $this->getAll(); - return isset($data[$name]) ? $data[$name] : null; + return $data[$name] ?? null; } /** diff --git a/lib/internal/Magento/Framework/Module/ModuleList.php b/lib/internal/Magento/Framework/Module/ModuleList.php index 406aa9efd31a0..6ee061cffb3d0 100644 --- a/lib/internal/Magento/Framework/Module/ModuleList.php +++ b/lib/internal/Magento/Framework/Module/ModuleList.php @@ -90,7 +90,7 @@ public function getAll() public function getOne($name) { $enabled = $this->getAll(); - return isset($enabled[$name]) ? $enabled[$name] : null; + return $enabled[$name] ?? null; } /** diff --git a/lib/internal/Magento/Framework/Module/ModuleResource.php b/lib/internal/Magento/Framework/Module/ModuleResource.php index ed740d459060e..9f7ac2a1b393c 100644 --- a/lib/internal/Magento/Framework/Module/ModuleResource.php +++ b/lib/internal/Magento/Framework/Module/ModuleResource.php @@ -84,7 +84,7 @@ public function getDbVersion($moduleName) return false; } $this->_loadVersion('db'); - return isset(self::$schemaVersions[$moduleName]) ? self::$schemaVersions[$moduleName] : false; + return self::$schemaVersions[$moduleName] ?? false; } /** @@ -116,7 +116,7 @@ public function getDataVersion($moduleName) return false; } $this->_loadVersion('data'); - return isset(self::$dataVersions[$moduleName]) ? self::$dataVersions[$moduleName] : false; + return self::$dataVersions[$moduleName] ?? false; } /** diff --git a/lib/internal/Magento/Framework/Module/PackageInfo.php b/lib/internal/Magento/Framework/Module/PackageInfo.php index 7edb0c04ebf98..0dce507ba26f4 100644 --- a/lib/internal/Magento/Framework/Module/PackageInfo.php +++ b/lib/internal/Magento/Framework/Module/PackageInfo.php @@ -283,6 +283,6 @@ public function getConflict($moduleName) public function getVersion($moduleName) { $this->load(); - return isset($this->modulePackageVersionMap[$moduleName]) ? $this->modulePackageVersionMap[$moduleName] : ''; + return $this->modulePackageVersionMap[$moduleName] ?? ''; } } diff --git a/lib/internal/Magento/Framework/Notification/MessageList.php b/lib/internal/Magento/Framework/Notification/MessageList.php index 8fb91890b2ff0..ac753b48c8944 100644 --- a/lib/internal/Magento/Framework/Notification/MessageList.php +++ b/lib/internal/Magento/Framework/Notification/MessageList.php @@ -72,7 +72,7 @@ protected function _loadMessages() public function getMessageByIdentity($identity) { $this->_loadMessages(); - return isset($this->_messages[$identity]) ? $this->_messages[$identity] : null; + return $this->_messages[$identity] ?? null; } /** diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Factory/Fixture/Polymorphous.php b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Factory/Fixture/Polymorphous.php index ebb7d76dcb63c..0c1a2128560f8 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Factory/Fixture/Polymorphous.php +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Factory/Fixture/Polymorphous.php @@ -26,6 +26,6 @@ public function __construct() */ public function getArg($key) { - return isset($this->args[$key]) ? $this->args[$key] : null; + return $this->args[$key] ?? null; } } diff --git a/lib/internal/Magento/Framework/Pricing/Amount/Base.php b/lib/internal/Magento/Framework/Pricing/Amount/Base.php index 2664ccc54944c..d055819a4a126 100644 --- a/lib/internal/Magento/Framework/Pricing/Amount/Base.php +++ b/lib/internal/Magento/Framework/Pricing/Amount/Base.php @@ -105,9 +105,7 @@ public function getBaseAmount() */ public function getAdjustmentAmount($adjustmentCode) { - return isset($this->adjustmentAmounts[$adjustmentCode]) - ? $this->adjustmentAmounts[$adjustmentCode] - : false; + return $this->adjustmentAmounts[$adjustmentCode] ?? false; } /** diff --git a/lib/internal/Magento/Framework/Pricing/Price/Pool.php b/lib/internal/Magento/Framework/Pricing/Price/Pool.php index b460113fc32c8..dfdd0c52681e1 100644 --- a/lib/internal/Magento/Framework/Pricing/Price/Pool.php +++ b/lib/internal/Magento/Framework/Pricing/Price/Pool.php @@ -141,6 +141,6 @@ public function offsetUnset($offset) */ public function offsetGet($offset) { - return isset($this->prices[$offset]) ? $this->prices[$offset] : null; + return $this->prices[$offset] ?? null; } } diff --git a/lib/internal/Magento/Framework/Search/Response/Aggregation.php b/lib/internal/Magento/Framework/Search/Response/Aggregation.php index 9cb7a364ff21c..ea72597c53034 100644 --- a/lib/internal/Magento/Framework/Search/Response/Aggregation.php +++ b/lib/internal/Magento/Framework/Search/Response/Aggregation.php @@ -47,7 +47,7 @@ public function getIterator() */ public function getBucket($bucketName) { - return isset($this->buckets[$bucketName]) ? $this->buckets[$bucketName] : null; + return $this->buckets[$bucketName] ?? null; } /** diff --git a/lib/internal/Magento/Framework/Session/SessionManager.php b/lib/internal/Magento/Framework/Session/SessionManager.php index ecf169cb0bc88..b855b05a38354 100644 --- a/lib/internal/Magento/Framework/Session/SessionManager.php +++ b/lib/internal/Magento/Framework/Session/SessionManager.php @@ -476,7 +476,7 @@ protected function _addHost() */ protected function _getHosts() { - return isset($_SESSION[self::HOST_KEY]) ? $_SESSION[self::HOST_KEY] : []; + return $_SESSION[self::HOST_KEY] ?? []; } /** diff --git a/lib/internal/Magento/Framework/Url.php b/lib/internal/Magento/Framework/Url.php index 2982edaa4766f..5a02beb798ed0 100644 --- a/lib/internal/Magento/Framework/Url.php +++ b/lib/internal/Magento/Framework/Url.php @@ -1074,7 +1074,7 @@ function ($match) { if ($match[1] == '?') { return isset($match[3]) ? '?' : ''; } elseif ($match[1] == '&' || $match[1] == '&') { - return isset($match[3]) ? $match[3] : ''; + return $match[3] ?? ''; } } }, diff --git a/lib/internal/Magento/Framework/Validator/Exception.php b/lib/internal/Magento/Framework/Validator/Exception.php index c70ecfabb52af..370f66c424b01 100644 --- a/lib/internal/Magento/Framework/Validator/Exception.php +++ b/lib/internal/Magento/Framework/Validator/Exception.php @@ -84,6 +84,6 @@ public function getMessages($type = '') } return $allMessages; } - return isset($this->messages[$type]) ? $this->messages[$type] : []; + return $this->messages[$type] ?? []; } } diff --git a/lib/internal/Magento/Framework/View/Asset/PropertyGroup.php b/lib/internal/Magento/Framework/View/Asset/PropertyGroup.php index ad86dfca47a25..4fe8f48d6b723 100644 --- a/lib/internal/Magento/Framework/View/Asset/PropertyGroup.php +++ b/lib/internal/Magento/Framework/View/Asset/PropertyGroup.php @@ -45,6 +45,6 @@ public function getProperties() */ public function getProperty($name) { - return isset($this->properties[$name]) ? $this->properties[$name] : null; + return $this->properties[$name] ?? null; } } diff --git a/lib/internal/Magento/Framework/View/BlockPool.php b/lib/internal/Magento/Framework/View/BlockPool.php index c50af9d5bbc5f..dff280057fdaf 100644 --- a/lib/internal/Magento/Framework/View/BlockPool.php +++ b/lib/internal/Magento/Framework/View/BlockPool.php @@ -72,6 +72,6 @@ public function get($name = null) return $this->blocks; } - return isset($this->blocks[$name]) ? $this->blocks[$name] : null; + return $this->blocks[$name] ?? null; } } diff --git a/lib/internal/Magento/Framework/View/DataSourcePool.php b/lib/internal/Magento/Framework/View/DataSourcePool.php index 24bdb6639981b..94f4f1dceae97 100644 --- a/lib/internal/Magento/Framework/View/DataSourcePool.php +++ b/lib/internal/Magento/Framework/View/DataSourcePool.php @@ -80,7 +80,7 @@ public function get($name = null) return $this->dataSources; } - return isset($this->dataSources[$name]) ? $this->dataSources[$name] : null; + return $this->dataSources[$name] ?? null; } /** @@ -107,6 +107,6 @@ public function assign($dataName, $namespace, $alias) */ public function getNamespaceData($namespace) { - return isset($this->assignments[$namespace]) ? $this->assignments[$namespace] : []; + return $this->assignments[$namespace] ?? []; } } diff --git a/lib/internal/Magento/Framework/View/Design/Theme/Validator.php b/lib/internal/Magento/Framework/View/Design/Theme/Validator.php index 06c78e7125040..04e775d730b56 100644 --- a/lib/internal/Magento/Framework/View/Design/Theme/Validator.php +++ b/lib/internal/Magento/Framework/View/Design/Theme/Validator.php @@ -118,7 +118,7 @@ public function addDataValidators($dataKey, $validators) public function getErrorMessages($dataKey = null) { if ($dataKey) { - return isset($this->_errorMessages[$dataKey]) ? $this->_errorMessages[$dataKey] : []; + return $this->_errorMessages[$dataKey] ?? []; } return $this->_errorMessages; } diff --git a/lib/internal/Magento/Framework/View/Element/UiComponent/Context.php b/lib/internal/Magento/Framework/View/Element/UiComponent/Context.php index 4430d18db1e70..7312f7546df9b 100644 --- a/lib/internal/Magento/Framework/View/Element/UiComponent/Context.php +++ b/lib/internal/Magento/Framework/View/Element/UiComponent/Context.php @@ -208,7 +208,7 @@ public function getFiltersParams() public function getFilterParam($key, $defaultValue = null) { $filter = $this->getFiltersParams(); - return isset($filter[$key]) ? $filter[$key] : $defaultValue; + return $filter[$key] ?? $defaultValue; } /** diff --git a/lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/DataProvider.php b/lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/DataProvider.php index b2288a47f8f83..baa4e94eed978 100644 --- a/lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/DataProvider.php +++ b/lib/internal/Magento/Framework/View/Element/UiComponent/DataProvider/DataProvider.php @@ -181,7 +181,7 @@ public function getMeta() */ public function getFieldSetMetaInfo($fieldSetName) { - return isset($this->meta[$fieldSetName]) ? $this->meta[$fieldSetName] : []; + return $this->meta[$fieldSetName] ?? []; } /** @@ -190,7 +190,7 @@ public function getFieldSetMetaInfo($fieldSetName) */ public function getFieldsMetaInfo($fieldSetName) { - return isset($this->meta[$fieldSetName]['children']) ? $this->meta[$fieldSetName]['children'] : []; + return $this->meta[$fieldSetName]['children'] ?? []; } /** @@ -200,9 +200,7 @@ public function getFieldsMetaInfo($fieldSetName) */ public function getFieldMetaInfo($fieldSetName, $fieldName) { - return isset($this->meta[$fieldSetName]['children'][$fieldName]) - ? $this->meta[$fieldSetName]['children'][$fieldName] - : []; + return $this->meta[$fieldSetName]['children'][$fieldName] ?? []; } /** @@ -291,7 +289,7 @@ public function getData() */ public function getConfigData() { - return isset($this->data['config']) ? $this->data['config'] : []; + return $this->data['config'] ?? []; } /** diff --git a/lib/internal/Magento/Framework/View/Layout/Generic.php b/lib/internal/Magento/Framework/View/Layout/Generic.php index b83545ff3c439..b527d1a817a96 100644 --- a/lib/internal/Magento/Framework/View/Layout/Generic.php +++ b/lib/internal/Magento/Framework/View/Layout/Generic.php @@ -200,6 +200,6 @@ protected function createChildFormComponent(UiComponentInterface $childComponent */ protected function getConfig($name) { - return isset($this->data['config'][$name]) ? $this->data['config'][$name] : null; + return $this->data['config'][$name] ?? null; } } diff --git a/lib/internal/Magento/Framework/View/Layout/ScheduledStructure.php b/lib/internal/Magento/Framework/View/Layout/ScheduledStructure.php index 25a04845a0728..3193e10282fd4 100644 --- a/lib/internal/Magento/Framework/View/Layout/ScheduledStructure.php +++ b/lib/internal/Magento/Framework/View/Layout/ScheduledStructure.php @@ -146,7 +146,7 @@ public function unsetElementToSort($elementName) */ public function getElementToSort($elementName, array $default = []) { - return isset($this->elementsToSort[$elementName]) ? $this->elementsToSort[$elementName] : $default; + return $this->elementsToSort[$elementName] ?? $default; } /** @@ -257,7 +257,7 @@ public function unsetElement($elementName) */ public function getElementToMove($elementName, $default = null) { - return isset($this->scheduledMoves[$elementName]) ? $this->scheduledMoves[$elementName] : $default; + return $this->scheduledMoves[$elementName] ?? $default; } /** @@ -370,7 +370,7 @@ public function unsetStructureElement($elementName) */ public function getStructureElementData($elementName, $default = null) { - return isset($this->scheduledData[$elementName]) ? $this->scheduledData[$elementName] : $default; + return $this->scheduledData[$elementName] ?? $default; } /** @@ -524,6 +524,6 @@ public function populateWithArray(array $data) */ private function getArrayValueByKey($key, array $array) { - return isset($array[$key]) ? $array[$key] : []; + return $array[$key] ?? []; } } diff --git a/lib/internal/Magento/Framework/View/Page/Config.php b/lib/internal/Magento/Framework/View/Page/Config.php index 058cad00320cd..226abc538112b 100644 --- a/lib/internal/Magento/Framework/View/Page/Config.php +++ b/lib/internal/Magento/Framework/View/Page/Config.php @@ -542,7 +542,7 @@ public function setElementAttribute($elementType, $attribute, $value) public function getElementAttribute($elementType, $attribute) { $this->build(); - return isset($this->elements[$elementType][$attribute]) ? $this->elements[$elementType][$attribute] : null; + return $this->elements[$elementType][$attribute] ?? null; } /** @@ -552,7 +552,7 @@ public function getElementAttribute($elementType, $attribute) public function getElementAttributes($elementType) { $this->build(); - return isset($this->elements[$elementType]) ? $this->elements[$elementType] : []; + return $this->elements[$elementType] ?? []; } /** diff --git a/lib/internal/Magento/Framework/Xml/Generator.php b/lib/internal/Magento/Framework/Xml/Generator.php index 975073e443d0e..f165793c2e2a4 100644 --- a/lib/internal/Magento/Framework/Xml/Generator.php +++ b/lib/internal/Magento/Framework/Xml/Generator.php @@ -146,8 +146,6 @@ public function setIndexedArrayItemName($name) */ protected function _getIndexedArrayItemName() { - return isset($this->_defaultIndexedArrayItemName) - ? $this->_defaultIndexedArrayItemName - : self::DEFAULT_ENTITY_ITEM_NAME; + return $this->_defaultIndexedArrayItemName ?? self::DEFAULT_ENTITY_ITEM_NAME; } }