Skip to content

Commit 51a0ad1

Browse files
authored
Merge pull request #29581 from mvmx/simplify-isset
[5.8] Simplify isset()
2 parents bd40f77 + 64daf1c commit 51a0ad1

4 files changed

Lines changed: 6 additions & 14 deletions

File tree

src/Illuminate/Container/Container.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -753,9 +753,7 @@ protected function getContextualConcrete($abstract)
753753
*/
754754
protected function findInContextualBindings($abstract)
755755
{
756-
if (isset($this->contextual[end($this->buildStack)][$abstract])) {
757-
return $this->contextual[end($this->buildStack)][$abstract];
758-
}
756+
return $this->contextual[end($this->buildStack)][$abstract] ?? null;
759757
}
760758

761759
/**

src/Illuminate/Database/Connectors/SqlServerConnector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ protected function buildConnectString($driver, array $arguments)
166166
*/
167167
protected function buildHostString(array $config, $separator)
168168
{
169-
if (isset($config['port']) && ! empty($config['port'])) {
170-
return $config['host'].$separator.$config['port'];
171-
} else {
169+
if (empty($config['port'])) {
172170
return $config['host'];
173171
}
172+
173+
return $config['host'].$separator.$config['port'];
174174
}
175175

176176
/**

src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,7 @@ public function getAttributeValue($key)
372372
*/
373373
protected function getAttributeFromArray($key)
374374
{
375-
if (isset($this->attributes[$key])) {
376-
return $this->attributes[$key];
377-
}
375+
return $this->attributes[$key] ?? null;
378376
}
379377

380378
/**

src/Illuminate/Log/ParsesLogConfiguration.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ protected function level(array $config)
5757
*/
5858
protected function parseChannel(array $config)
5959
{
60-
if (! isset($config['name'])) {
61-
return $this->getFallbackChannelName();
62-
}
63-
64-
return $config['name'];
60+
return $config['name'] ?? $this->getFallbackChannelName();
6561
}
6662
}

0 commit comments

Comments
 (0)