Skip to content

Commit a2708ab

Browse files
authored
Isset and unset do no need to be called multiple time. (#41219)
1 parent ac8f610 commit a2708ab

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

src/Illuminate/Cache/CacheManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ protected function newDynamodbClient(array $config)
264264
'endpoint' => $config['endpoint'] ?? null,
265265
];
266266

267-
if (isset($config['key']) && isset($config['secret'])) {
267+
if (isset($config['key'], $config['secret'])) {
268268
$dynamoConfig['credentials'] = Arr::only(
269269
$config, ['key', 'secret', 'token']
270270
);

src/Illuminate/Support/Reflector.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ public static function isCallable($var, $syntaxOnly = false)
2323
return is_callable($var, $syntaxOnly);
2424
}
2525

26-
if ((! isset($var[0]) || ! isset($var[1])) ||
27-
! is_string($var[1] ?? null)) {
26+
if (! isset($var[0], $var[1]) || ! is_string($var[1] ?? null)) {
2827
return false;
2928
}
3029

src/Illuminate/View/Compilers/ComponentTagCompiler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ public function findClassByComponent(string $component)
296296

297297
$prefix = $segments[0];
298298

299-
if (! isset($this->namespaces[$prefix]) || ! isset($segments[1])) {
299+
if (! isset($this->namespaces[$prefix], $segments[1])) {
300300
return;
301301
}
302302

tests/Database/DatabaseMigrationCreatorTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ public function testBasicCreateMethodCallsPostCreateHooks()
3535
$table = 'baz';
3636

3737
$creator = $this->getCreator();
38-
unset($_SERVER['__migration.creator.table']);
39-
unset($_SERVER['__migration.creator.path']);
38+
unset($_SERVER['__migration.creator.table'], $_SERVER['__migration.creator.path']);
4039
$creator->afterCreate(function ($table, $path) {
4140
$_SERVER['__migration.creator.table'] = $table;
4241
$_SERVER['__migration.creator.path'] = $path;
@@ -55,8 +54,7 @@ public function testBasicCreateMethodCallsPostCreateHooks()
5554
$this->assertEquals($_SERVER['__migration.creator.table'], $table);
5655
$this->assertEquals($_SERVER['__migration.creator.path'], 'foo/foo_create_bar.php');
5756

58-
unset($_SERVER['__migration.creator.table']);
59-
unset($_SERVER['__migration.creator.path']);
57+
unset($_SERVER['__migration.creator.table'], $_SERVER['__migration.creator.path']);
6058
}
6159

6260
public function testTableUpdateMigrationStoresMigrationFile()

0 commit comments

Comments
 (0)