Skip to content

Commit

Permalink
Isset and unset do no need to be called multiple time. (#41219)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmichot authored Feb 24, 2022
1 parent ac8f610 commit a2708ab
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Cache/CacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ protected function newDynamodbClient(array $config)
'endpoint' => $config['endpoint'] ?? null,
];

if (isset($config['key']) && isset($config['secret'])) {
if (isset($config['key'], $config['secret'])) {
$dynamoConfig['credentials'] = Arr::only(
$config, ['key', 'secret', 'token']
);
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Support/Reflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public static function isCallable($var, $syntaxOnly = false)
return is_callable($var, $syntaxOnly);
}

if ((! isset($var[0]) || ! isset($var[1])) ||
! is_string($var[1] ?? null)) {
if (! isset($var[0], $var[1]) || ! is_string($var[1] ?? null)) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/View/Compilers/ComponentTagCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public function findClassByComponent(string $component)

$prefix = $segments[0];

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

Expand Down
6 changes: 2 additions & 4 deletions tests/Database/DatabaseMigrationCreatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ public function testBasicCreateMethodCallsPostCreateHooks()
$table = 'baz';

$creator = $this->getCreator();
unset($_SERVER['__migration.creator.table']);
unset($_SERVER['__migration.creator.path']);
unset($_SERVER['__migration.creator.table'], $_SERVER['__migration.creator.path']);
$creator->afterCreate(function ($table, $path) {
$_SERVER['__migration.creator.table'] = $table;
$_SERVER['__migration.creator.path'] = $path;
Expand All @@ -55,8 +54,7 @@ public function testBasicCreateMethodCallsPostCreateHooks()
$this->assertEquals($_SERVER['__migration.creator.table'], $table);
$this->assertEquals($_SERVER['__migration.creator.path'], 'foo/foo_create_bar.php');

unset($_SERVER['__migration.creator.table']);
unset($_SERVER['__migration.creator.path']);
unset($_SERVER['__migration.creator.table'], $_SERVER['__migration.creator.path']);
}

public function testTableUpdateMigrationStoresMigrationFile()
Expand Down

0 comments on commit a2708ab

Please sign in to comment.