Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Illuminate/Bus/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);
}

/**
Expand Down
16 changes: 8 additions & 8 deletions src/Illuminate/Cache/CacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ protected function resolve($name)

if (isset($this->customCreators[$config['driver']])) {
return $this->callCustomCreator($config);
} else {
$driverMethod = 'create'.ucfirst($config['driver']).'Driver';

if (method_exists($this, $driverMethod)) {
return $this->{$driverMethod}($config);
} else {
throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported.");
}
}

$driverMethod = 'create'.ucfirst($config['driver']).'Driver';

if (method_exists($this, $driverMethod)) {
return $this->{$driverMethod}($config);
}

throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported.");
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Console/Scheduling/CommandBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Connectors/PostgresConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ protected function formatSchema($schema)
{
if (is_array($schema)) {
return '"'.implode('", "', $schema).'"';
} else {
return '"'.$schema.'"';
}

return '"'.$schema.'"';
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Database/Connectors/SqlServerConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ protected function getDsn(array $config)
return $this->getDblibDsn($config);
} elseif ($this->prefersOdbc($config)) {
return $this->getOdbcDsn($config);
} else {
return $this->getSqlSrvDsn($config);
}

return $this->getSqlSrvDsn($config);
}

/**
Expand Down Expand Up @@ -158,9 +158,9 @@ protected function buildHostString(array $config, $separator)
{
if (isset($config['port']) && ! empty($config['port'])) {
return $config['host'].$separator.$config['port'];
} else {
return $config['host'];
}

return $config['host'];
}

/**
Expand Down
6 changes: 2 additions & 4 deletions src/Illuminate/Database/Migrations/MigrationCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,9 @@ protected function getStub($table, $create)
// We also have stubs for creating new tables and modifying existing tables
// to save the developer some typing when they are creating a new tables
// or modifying existing tables. We'll grab the appropriate stub here.
else {
$stub = $create ? 'create.stub' : 'update.stub';
$stub = $create ? 'create.stub' : 'update.stub';

return $this->files->get($this->stubPath()."/{$stub}");
}
return $this->files->get($this->stubPath()."/{$stub}");
}

/**
Expand Down
12 changes: 6 additions & 6 deletions src/Illuminate/Database/Migrations/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ public function rollback($paths = [], array $options = [])
$this->note('<info>Nothing to rollback.</info>');

return [];
} else {
return $this->rollbackMigrations($migrations, $paths, $options);
}

return $this->rollbackMigrations($migrations, $paths, $options);
}

/**
Expand All @@ -219,9 +219,9 @@ protected function getMigrationsForRollback(array $options)
{
if (($steps = $options['step'] ?? 0) > 0) {
return $this->repository->getMigrations($steps);
} else {
return $this->repository->getLast();
}

return $this->repository->getLast();
}

/**
Expand Down Expand Up @@ -281,9 +281,9 @@ public function reset($paths = [], $pretend = false)
$this->note('<info>Nothing to rollback.</info>');

return [];
} else {
return $this->resetMigrations($migrations, $paths, $pretend);
}

return $this->resetMigrations($migrations, $paths, $pretend);
}

/**
Expand Down
7 changes: 3 additions & 4 deletions src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,8 @@ protected function parseSubSelect($query)
return [$query->toSql(), $query->getBindings()];
} elseif (is_string($query)) {
return [$query, []];
} else {
throw new InvalidArgumentException;
}
throw new InvalidArgumentException;
}

/**
Expand Down Expand Up @@ -1771,9 +1770,9 @@ public function getCountForPagination($columns = ['*'])
return 0;
} elseif (is_object($results[0])) {
return (int) $results[0]->aggregate;
} else {
return (int) array_change_key_case((array) $results[0])['aggregate'];
}

return (int) array_change_key_case((array) $results[0])['aggregate'];
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Query/Grammars/MySqlGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ');
}

Expand Down
16 changes: 8 additions & 8 deletions src/Illuminate/Events/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,9 @@ public function makeListener($listener, $wildcard = false)
return function ($event, $payload) use ($listener, $wildcard) {
if ($wildcard) {
return $listener($event, $payload);
} else {
return $listener(...array_values($payload));
}

return $listener(...array_values($payload));
};
}

Expand All @@ -363,11 +363,11 @@ public function createClassListener($listener, $wildcard = false)
return function ($event, $payload) use ($listener, $wildcard) {
if ($wildcard) {
return call_user_func($this->createClassCallable($listener), $event, $payload);
} else {
return call_user_func_array(
$this->createClassCallable($listener), $payload
);
}

return call_user_func_array(
$this->createClassCallable($listener), $payload
);
};
}

Expand All @@ -383,9 +383,9 @@ protected function createClassCallable($listener)

if ($this->handlerShouldBeQueued($class)) {
return $this->createQueuedHandlerCallable($class, $method);
} else {
return [$this->container->make($class), $method];
}

return [$this->container->make($class), $method];
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Filesystem/FilesystemAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@ public function url($path)
return $this->getAwsUrl($adapter, $path);
} elseif ($adapter instanceof LocalAdapter) {
return $this->getLocalUrl($path);
} else {
throw new RuntimeException('This driver does not support retrieving URLs.');
}

throw new RuntimeException('This driver does not support retrieving URLs.');
}

/**
Expand Down Expand Up @@ -375,9 +375,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;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Filesystem/FilesystemManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Foundation/Console/ListenerMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Foundation/Console/TestMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

/**
Expand All @@ -65,9 +65,9 @@ protected function getDefaultNamespace($rootNamespace)
{
if ($this->option('unit')) {
return $rootNamespace.'\Unit';
} else {
return $rootNamespace.'\Feature';
}

return $rootNamespace.'\Feature';
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Foundation/Testing/TestResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,9 @@ public function decodeResponseJson()
if (is_null($decodedResponse) || $decodedResponse === false) {
if ($this->exception) {
throw $this->exception;
} else {
PHPUnit::fail('Invalid JSON was returned from the route.');
}

PHPUnit::fail('Invalid JSON was returned from the route.');
}

return $decodedResponse;
Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Foundation/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,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);
}
}

Expand Down Expand Up @@ -482,9 +482,9 @@ function factory()
return $factory->of($arguments[0], $arguments[1])->times($arguments[2] ?? null);
} elseif (isset($arguments[1])) {
return $factory->of($arguments[0])->times($arguments[1]);
} else {
return $factory->of($arguments[0]);
}

return $factory->of($arguments[0]);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Mail/Mailable.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,9 @@ protected function hasRecipient($address, $name = null, $property = 'to')
return collect($this->{$property})->contains(function ($actual) use ($expected) {
if (! isset($expected['name'])) {
return $actual['address'] == $expected['address'];
} else {
return $actual == $expected;
}

return $actual == $expected;
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Routing/ResourceRegistrar.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,8 @@ public static function verbs(array $verbs = [])
{
if (empty($verbs)) {
return static::$verbs;
} else {
static::$verbs = array_merge(static::$verbs, $verbs);
}

static::$verbs = array_merge(static::$verbs, $verbs);
}
}
8 changes: 4 additions & 4 deletions src/Illuminate/Routing/RouteUrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);
}

Expand Down
Loading