diff --git a/src/Illuminate/Broadcasting/BroadcastManager.php b/src/Illuminate/Broadcasting/BroadcastManager.php index eb913ef3774a..2ba34cac3ca0 100644 --- a/src/Illuminate/Broadcasting/BroadcastManager.php +++ b/src/Illuminate/Broadcasting/BroadcastManager.php @@ -111,15 +111,9 @@ public function queue($event) $connection = $event->connection; } - $queue = null; - - if (method_exists($event, 'broadcastQueue')) { - $queue = $event->broadcastQueue(); - } elseif (isset($event->broadcastQueue)) { - $queue = $event->broadcastQueue; - } elseif (isset($event->queue)) { - $queue = $event->queue; - } + $queue = (method_exists($event, 'broadcastQueue')) + ? $event->broadcastQueue() + : $event->broadcastQueue ?? $event->queue ?? null; $this->app->make('queue')->connection($connection)->pushOn( $queue, new BroadcastEvent(clone $event) diff --git a/src/Illuminate/Bus/Dispatcher.php b/src/Illuminate/Bus/Dispatcher.php index 9733b442f9c3..1a7b9a4087a9 100644 --- a/src/Illuminate/Bus/Dispatcher.php +++ b/src/Illuminate/Bus/Dispatcher.php @@ -71,9 +71,9 @@ public function dispatch($command) { if ($this->queueResolver && $this->commandShouldBeQueued($command)) { return $this->dispatchToQueue($command); - } else { - return $this->dispatchNow($command); } + + return $this->dispatchNow($command); } /** @@ -155,9 +155,9 @@ public function dispatchToQueue($command) if (method_exists($command, 'queue')) { return $command->queue($queue, $command); - } else { - return $this->pushCommandToQueue($queue, $command); } + + return $this->pushCommandToQueue($queue, $command); } /** diff --git a/src/Illuminate/Cache/CacheManager.php b/src/Illuminate/Cache/CacheManager.php index f52053c9b0bf..abf33600a332 100755 --- a/src/Illuminate/Cache/CacheManager.php +++ b/src/Illuminate/Cache/CacheManager.php @@ -101,11 +101,11 @@ protected function resolve($name) } else { $driverMethod = 'create'.ucfirst($config['driver']).'Driver'; - if (method_exists($this, $driverMethod)) { - return $this->{$driverMethod}($config); - } else { + if (! method_exists($this, $driverMethod)) { throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported."); } + + return $this->{$driverMethod}($config); } } diff --git a/src/Illuminate/Cache/MemcachedStore.php b/src/Illuminate/Cache/MemcachedStore.php index 00ba8b7c9411..94b223744596 100755 --- a/src/Illuminate/Cache/MemcachedStore.php +++ b/src/Illuminate/Cache/MemcachedStore.php @@ -78,13 +78,9 @@ public function many(array $keys) return $this->prefix.$key; }, $keys); - if ($this->onVersionThree) { - $values = $this->memcached->getMulti($prefixedKeys, Memcached::GET_PRESERVE_ORDER); - } else { - $null = null; - - $values = $this->memcached->getMulti($prefixedKeys, $null, Memcached::GET_PRESERVE_ORDER); - } + $values = ($this->onVersionThree) + ? $this->memcached->getMulti($prefixedKeys, Memcached::GET_PRESERVE_ORDER) + : $this->memcached->getMulti($prefixedKeys, null, Memcached::GET_PRESERVE_ORDER); if ($this->memcached->getResultCode() != 0) { return array_fill_keys($keys, null); diff --git a/src/Illuminate/Console/Scheduling/CommandBuilder.php b/src/Illuminate/Console/Scheduling/CommandBuilder.php index acf60dd60484..4e37a0d7c402 100644 --- a/src/Illuminate/Console/Scheduling/CommandBuilder.php +++ b/src/Illuminate/Console/Scheduling/CommandBuilder.php @@ -17,9 +17,9 @@ public function buildCommand(Event $event) { if ($event->runInBackground) { return $this->buildBackgroundCommand($event); - } else { - return $this->buildForegroundCommand($event); } + + return $this->buildForegroundCommand($event); } /** diff --git a/src/Illuminate/Container/Container.php b/src/Illuminate/Container/Container.php index 54d10354876a..f826b4e475fd 100755 --- a/src/Illuminate/Container/Container.php +++ b/src/Illuminate/Container/Container.php @@ -627,11 +627,9 @@ protected function resolve($abstract, $parameters = []) // We're ready to instantiate an instance of the concrete type registered for // the binding. This will instantiate the types, as well as resolve any of // its "nested" dependencies recursively until all have gotten resolved. - if ($this->isBuildable($concrete, $abstract)) { - $object = $this->build($concrete); - } else { - $object = $this->make($concrete); - } + $object = ($this->isBuildable($concrete, $abstract)) + ? $this->build($concrete) + : $this->make($concrete); // If we defined any extenders for this type, we'll need to spin through them // and apply them to the object being built. This allows for the extension diff --git a/src/Illuminate/Database/Connectors/PostgresConnector.php b/src/Illuminate/Database/Connectors/PostgresConnector.php index 0581b8b2aa5a..5129b4b4474d 100755 --- a/src/Illuminate/Database/Connectors/PostgresConnector.php +++ b/src/Illuminate/Database/Connectors/PostgresConnector.php @@ -106,9 +106,9 @@ protected function formatSchema($schema) { if (is_array($schema)) { return '"'.implode('", "', $schema).'"'; - } else { - return '"'.$schema.'"'; } + + return '"'.$schema.'"'; } /** diff --git a/src/Illuminate/Database/Connectors/SqlServerConnector.php b/src/Illuminate/Database/Connectors/SqlServerConnector.php index f9c4d0aafffa..01d1d8149476 100755 --- a/src/Illuminate/Database/Connectors/SqlServerConnector.php +++ b/src/Illuminate/Database/Connectors/SqlServerConnector.php @@ -45,11 +45,13 @@ protected function getDsn(array $config) // need to establish the PDO connections and return them back for use. if (in_array('dblib', $this->getAvailableDrivers())) { return $this->getDblibDsn($config); - } elseif ($this->prefersOdbc($config)) { + } + + if ($this->prefersOdbc($config)) { return $this->getOdbcDsn($config); - } else { - return $this->getSqlSrvDsn($config); } + + return $this->getSqlSrvDsn($config); } /** diff --git a/src/Illuminate/Database/Eloquent/ModelNotFoundException.php b/src/Illuminate/Database/Eloquent/ModelNotFoundException.php index c3db8242fd0a..e1630b4389c2 100755 --- a/src/Illuminate/Database/Eloquent/ModelNotFoundException.php +++ b/src/Illuminate/Database/Eloquent/ModelNotFoundException.php @@ -34,12 +34,9 @@ public function setModel($model, $ids = []) $this->ids = Arr::wrap($ids); $this->message = "No query results for model [{$model}]"; - - if (count($this->ids) > 0) { - $this->message .= ' '.implode(', ', $this->ids); - } else { - $this->message .= '.'; - } + $this->message .= (count($this->ids) > 0) + ? ' '.implode(', ', $this->ids) + : '.'; return $this; } diff --git a/src/Illuminate/Database/Migrations/Migrator.php b/src/Illuminate/Database/Migrations/Migrator.php index 535bb316facd..42fbb58cfe45 100755 --- a/src/Illuminate/Database/Migrations/Migrator.php +++ b/src/Illuminate/Database/Migrations/Migrator.php @@ -204,9 +204,9 @@ public function rollback($paths = [], array $options = []) $this->note('Nothing to rollback.'); return []; - } else { - return $this->rollbackMigrations($migrations, $paths, $options); } + + return $this->rollbackMigrations($migrations, $paths, $options); } /** diff --git a/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php b/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php index 6943c147a07c..4403a25724b1 100755 --- a/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php +++ b/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php @@ -144,9 +144,9 @@ protected function compileUpdateColumns($values) return collect($values)->map(function ($value, $key) { if ($this->isJsonSelector($key)) { return $this->compileJsonUpdateColumn($key, new JsonExpression($value)); - } else { - return $this->wrap($key).' = '.$this->parameter($value); } + + return $this->wrap($key).' = '.$this->parameter($value); })->implode(', '); } diff --git a/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php b/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php index 65140c49b2af..4c5806bb9b25 100755 --- a/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php +++ b/src/Illuminate/Database/Query/Processors/SqlServerProcessor.php @@ -23,11 +23,9 @@ public function processInsertGetId(Builder $query, $sql, $values, $sequence = nu $connection->insert($sql, $values); - if ($connection->getConfig('odbc') === true) { - $id = $this->processInsertGetIdForOdbc($connection); - } else { - $id = $connection->getPdo()->lastInsertId(); - } + $id = ($connection->getConfig('odbc') === true) + ? $this->processInsertGetIdForOdbc($connection) + : $connection->getPdo()->lastInsertId(); return is_numeric($id) ? (int) $id : $id; } diff --git a/src/Illuminate/Filesystem/FilesystemAdapter.php b/src/Illuminate/Filesystem/FilesystemAdapter.php index 84aa4b7dc568..a2d355e50ddf 100644 --- a/src/Illuminate/Filesystem/FilesystemAdapter.php +++ b/src/Illuminate/Filesystem/FilesystemAdapter.php @@ -391,9 +391,9 @@ protected function getLocalUrl($path) // are really supposed to use. We will remove the public from this path here. if (Str::contains($path, '/storage/public/')) { return Str::replaceFirst('/public/', '/', $path); - } else { - return $path; } + + return $path; } /** diff --git a/src/Illuminate/Filesystem/FilesystemManager.php b/src/Illuminate/Filesystem/FilesystemManager.php index 7bf8c008034e..53ee57174c8e 100644 --- a/src/Illuminate/Filesystem/FilesystemManager.php +++ b/src/Illuminate/Filesystem/FilesystemManager.php @@ -120,9 +120,9 @@ protected function resolve($name) if (method_exists($this, $driverMethod)) { return $this->{$driverMethod}($config); - } else { - throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported."); } + + throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported."); } /** diff --git a/src/Illuminate/Foundation/Console/ListenerMakeCommand.php b/src/Illuminate/Foundation/Console/ListenerMakeCommand.php index bcf6892c7119..ce3e25ef059f 100644 --- a/src/Illuminate/Foundation/Console/ListenerMakeCommand.php +++ b/src/Illuminate/Foundation/Console/ListenerMakeCommand.php @@ -67,11 +67,11 @@ protected function getStub() return $this->option('event') ? __DIR__.'/stubs/listener-queued.stub' : __DIR__.'/stubs/listener-queued-duck.stub'; - } else { - return $this->option('event') - ? __DIR__.'/stubs/listener.stub' - : __DIR__.'/stubs/listener-duck.stub'; } + + return $this->option('event') + ? __DIR__.'/stubs/listener.stub' + : __DIR__.'/stubs/listener-duck.stub'; } /** diff --git a/src/Illuminate/Foundation/Console/TestMakeCommand.php b/src/Illuminate/Foundation/Console/TestMakeCommand.php index 15b8cdf85368..eb418e255f8e 100644 --- a/src/Illuminate/Foundation/Console/TestMakeCommand.php +++ b/src/Illuminate/Foundation/Console/TestMakeCommand.php @@ -37,9 +37,9 @@ protected function getStub() { if ($this->option('unit')) { return __DIR__.'/stubs/unit-test.stub'; - } else { - return __DIR__.'/stubs/test.stub'; } + + return __DIR__.'/stubs/test.stub'; } /** @@ -65,9 +65,9 @@ protected function getDefaultNamespace($rootNamespace) { if ($this->option('unit')) { return $rootNamespace.'\Unit'; - } else { - return $rootNamespace.'\Feature'; } + + return $rootNamespace.'\Feature'; } /** diff --git a/src/Illuminate/Foundation/Testing/WithoutEvents.php b/src/Illuminate/Foundation/Testing/WithoutEvents.php index fa5df3ce8f5b..26066c90b04c 100644 --- a/src/Illuminate/Foundation/Testing/WithoutEvents.php +++ b/src/Illuminate/Foundation/Testing/WithoutEvents.php @@ -15,8 +15,8 @@ public function disableEventsForAllTests() { if (method_exists($this, 'withoutEvents')) { $this->withoutEvents(); - } else { - throw new Exception('Unable to disable events. ApplicationTrait not used.'); } + + throw new Exception('Unable to disable events. ApplicationTrait not used.'); } } diff --git a/src/Illuminate/Foundation/Testing/WithoutMiddleware.php b/src/Illuminate/Foundation/Testing/WithoutMiddleware.php index 269b532d3150..609ece97d52a 100644 --- a/src/Illuminate/Foundation/Testing/WithoutMiddleware.php +++ b/src/Illuminate/Foundation/Testing/WithoutMiddleware.php @@ -15,8 +15,8 @@ public function disableMiddlewareForAllTests() { if (method_exists($this, 'withoutMiddleware')) { $this->withoutMiddleware(); - } else { - throw new Exception('Unable to disable middleware. MakesHttpRequests trait not used.'); } + + throw new Exception('Unable to disable middleware. MakesHttpRequests trait not used.'); } } diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index cebaee5b0097..33db56d12ce2 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -149,9 +149,9 @@ function auth($guard = null) { if (is_null($guard)) { return app(AuthFactory::class); - } else { - return app(AuthFactory::class)->guard($guard); } + + return app(AuthFactory::class)->guard($guard); } } diff --git a/src/Illuminate/Routing/RouteUrlGenerator.php b/src/Illuminate/Routing/RouteUrlGenerator.php index 7e7b73fb1b1f..2d3e35ae0721 100644 --- a/src/Illuminate/Routing/RouteUrlGenerator.php +++ b/src/Illuminate/Routing/RouteUrlGenerator.php @@ -140,9 +140,9 @@ protected function getRouteScheme($route) return 'http://'; } elseif ($route->httpsOnly()) { return 'https://'; - } else { - return $this->url->formatScheme(null); } + + return $this->url->formatScheme(null); } /** @@ -212,9 +212,9 @@ protected function replaceNamedParameters($path, &$parameters) return Arr::pull($parameters, $m[1]); } elseif (isset($this->defaultParameters[$m[1]])) { return $this->defaultParameters[$m[1]]; - } else { - return $m[0]; } + + return $m[0]; }, $path); } diff --git a/src/Illuminate/Routing/UrlGenerator.php b/src/Illuminate/Routing/UrlGenerator.php index 3e9481047c0b..7726e39576dd 100755 --- a/src/Illuminate/Routing/UrlGenerator.php +++ b/src/Illuminate/Routing/UrlGenerator.php @@ -142,9 +142,9 @@ public function previous($fallback = false) return $url; } elseif ($fallback) { return $this->to($fallback); - } else { - return $this->to('/'); } + + return $this->to('/'); } /** @@ -351,9 +351,9 @@ protected function formatAction($action) { if ($this->rootNamespace && ! (strpos($action, '\\') === 0)) { return $this->rootNamespace.'\\'.$action; - } else { - return trim($action, '\\'); } + + return trim($action, '\\'); } /** diff --git a/src/Illuminate/Session/SessionManager.php b/src/Illuminate/Session/SessionManager.php index f8ad802504b0..6aef0516a67f 100755 --- a/src/Illuminate/Session/SessionManager.php +++ b/src/Illuminate/Session/SessionManager.php @@ -165,9 +165,9 @@ protected function buildSession($handler) { if ($this->app['config']['session.encrypt']) { return $this->buildEncryptedSession($handler); - } else { - return new Store($this->app['config']['session.cookie'], $handler); } + + return new Store($this->app['config']['session.cookie'], $handler); } /** diff --git a/src/Illuminate/Validation/ValidationRuleParser.php b/src/Illuminate/Validation/ValidationRuleParser.php index 96a89baf0252..8a17de23fb2f 100644 --- a/src/Illuminate/Validation/ValidationRuleParser.php +++ b/src/Illuminate/Validation/ValidationRuleParser.php @@ -87,9 +87,9 @@ protected function explodeExplicitRule($rule) return explode('|', $rule); } elseif (is_object($rule)) { return [$this->prepareRule($rule)]; - } else { - return array_map([$this, 'prepareRule'], $rule); } + + return array_map([$this, 'prepareRule'], $rule); } /** @@ -195,11 +195,9 @@ public static function parse($rules) return [$rules, []]; } - if (is_array($rules)) { - $rules = static::parseArrayRule($rules); - } else { - $rules = static::parseStringRule($rules); - } + $rules = (is_array($rules)) + ? static::parseArrayRule($rules) + : static::parseStringRule($rules); $rules[0] = static::normalizeRule($rules[0]);