Skip to content

Commit 83717c7

Browse files
author
Stanislav Idolov
authored
ENGCOM-2972: Code improvement of lib files #18049
2 parents 4ba5b33 + 16ba51b commit 83717c7

File tree

9 files changed

+12
-20
lines changed

9 files changed

+12
-20
lines changed

lib/internal/Magento/Framework/Amqp/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function __destruct()
131131
public function getValue($key)
132132
{
133133
$this->load();
134-
return isset($this->data[$key]) ? $this->data[$key] : null;
134+
return $this->data[$key] ?? null;
135135
}
136136

137137
/**

lib/internal/Magento/Framework/App/Cache/State.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function __construct(DeploymentConfig $config, Writer $writer, $banAll =
7474
public function isEnabled($cacheType)
7575
{
7676
$this->load();
77-
return isset($this->statuses[$cacheType]) ? (bool)$this->statuses[$cacheType] : false;
77+
return (bool)($this->statuses[$cacheType] ?? false);
7878
}
7979

8080
/**

lib/internal/Magento/Framework/Data/Form/Element/Editor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function getPluginConfigOptions($pluginName, $key = null)
101101
$pluginOptions = $plugins[$pluginArrIndex]['options'];
102102

103103
if ($key !== null) {
104-
return isset($pluginOptions[$key]) ? $pluginOptions[$key] : null;
104+
return $pluginOptions[$key] ?? null;
105105
} else {
106106
return $pluginOptions;
107107
}

lib/internal/Magento/Framework/GraphQl/Schema/Type/Entity/DefaultMapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ public function __construct(array $map = [])
3030
*/
3131
public function getMappedTypes(string $entityName) : array
3232
{
33-
return isset($this->map[$entityName]) ? $this->map[$entityName] : [];
33+
return $this->map[$entityName] ?? [];
3434
}
3535
}

lib/internal/Magento/Framework/GraphQl/Schema/Type/Enum/DefaultDataMapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ public function __construct(array $map)
3030
*/
3131
public function getMappedEnums(string $enumName) : array
3232
{
33-
return isset($this->map[$enumName]) ? $this->map[$enumName] : [];
33+
return $this->map[$enumName] ?? [];
3434
}
3535
}

lib/internal/Magento/Framework/MessageQueue/Config.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ public function __construct(Config\Data $queueConfigData)
3535
public function getExchangeByTopic($topicName)
3636
{
3737
$publisherConfig = $this->getPublisherConfigByTopic($topicName);
38-
return isset($publisherConfig[ConfigInterface::PUBLISHER_EXCHANGE])
39-
? $publisherConfig[ConfigInterface::PUBLISHER_EXCHANGE]
40-
: null;
38+
return $publisherConfig[ConfigInterface::PUBLISHER_EXCHANGE] ?? null;
4139
}
4240

4341
/**
@@ -76,9 +74,7 @@ public function getConnectionByTopic($topic)
7674
} catch (\Magento\Framework\Exception\LocalizedException $e) {
7775
return null;
7876
}
79-
return isset($publisherConfig[ConfigInterface::PUBLISHER_CONNECTION])
80-
? $publisherConfig[ConfigInterface::PUBLISHER_CONNECTION]
81-
: null;
77+
return $publisherConfig[ConfigInterface::PUBLISHER_CONNECTION] ?? null;
8278
}
8379

8480
/**

lib/internal/Magento/Framework/MessageQueue/Consumer/Config/Env/Reader.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ public function __construct(\Magento\Framework\MessageQueue\Config\Reader\Env $e
3333
public function read($scope = null)
3434
{
3535
$configData = $this->envConfig->read($scope);
36-
return isset($configData[\Magento\Framework\MessageQueue\Config\Reader\Env::ENV_CONSUMERS])
37-
? $configData[\Magento\Framework\MessageQueue\Config\Reader\Env::ENV_CONSUMERS]
38-
: [];
36+
return $configData[\Magento\Framework\MessageQueue\Config\Reader\Env::ENV_CONSUMERS] ?? [];
3937
}
4038
}

lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Schema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ public function addTable(Table $table)
7171
public function getTableByName($name)
7272
{
7373
$name = $this->resourceConnection->getTableName($name);
74-
return isset($this->tables[$name]) ? $this->tables[$name] : false;
74+
return $this->tables[$name] ?? false;
7575
}
7676
}

lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Table.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function getConstraints()
138138
*/
139139
public function getConstraintByName($name)
140140
{
141-
return isset($this->constraints[$name]) ? $this->constraints[$name] : false;
141+
return $this->constraints[$name] ?? false;
142142
}
143143

144144
/**
@@ -168,9 +168,7 @@ public function getReferenceConstraints()
168168
*/
169169
public function getPrimaryConstraint()
170170
{
171-
return isset($this->constraints[Internal::PRIMARY_NAME]) ?
172-
$this->constraints[Internal::PRIMARY_NAME] :
173-
false;
171+
return $this->constraints[Internal::PRIMARY_NAME] ?? false;
174172
}
175173

176174
/**
@@ -196,7 +194,7 @@ public function getInternalConstraints() : array
196194
*/
197195
public function getIndexByName($name)
198196
{
199-
return isset($this->indexes[$name]) ? $this->indexes[$name] : false;
197+
return $this->indexes[$name] ?? false;
200198
}
201199

202200
/**

0 commit comments

Comments
 (0)