From 94f702930ae440ad3bce478a5f987e7c3c929cc3 Mon Sep 17 00:00:00 2001 From: Lucas Michot Date: Thu, 24 Feb 2022 10:35:12 +0100 Subject: [PATCH] Isset and unset do no need to be called multiple time. --- src/Illuminate/Cache/CacheManager.php | 2 +- src/Illuminate/Support/Reflector.php | 3 +-- src/Illuminate/View/Compilers/ComponentTagCompiler.php | 2 +- tests/Database/DatabaseMigrationCreatorTest.php | 6 ++---- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Illuminate/Cache/CacheManager.php b/src/Illuminate/Cache/CacheManager.php index fb783e2c628a..9d87148193a0 100755 --- a/src/Illuminate/Cache/CacheManager.php +++ b/src/Illuminate/Cache/CacheManager.php @@ -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'] ); diff --git a/src/Illuminate/Support/Reflector.php b/src/Illuminate/Support/Reflector.php index b9007ed03d1b..1390c9dac965 100644 --- a/src/Illuminate/Support/Reflector.php +++ b/src/Illuminate/Support/Reflector.php @@ -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; } diff --git a/src/Illuminate/View/Compilers/ComponentTagCompiler.php b/src/Illuminate/View/Compilers/ComponentTagCompiler.php index 58a68b49d462..fe054c2e9158 100644 --- a/src/Illuminate/View/Compilers/ComponentTagCompiler.php +++ b/src/Illuminate/View/Compilers/ComponentTagCompiler.php @@ -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; } diff --git a/tests/Database/DatabaseMigrationCreatorTest.php b/tests/Database/DatabaseMigrationCreatorTest.php index 2b856ac74bbe..6a769885fdcb 100755 --- a/tests/Database/DatabaseMigrationCreatorTest.php +++ b/tests/Database/DatabaseMigrationCreatorTest.php @@ -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; @@ -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()