From cc0365c448fc2035f0dbc2155d8c0102bd9ceb7a Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Wed, 22 Jan 2025 15:19:28 -0600 Subject: [PATCH] [11.x] Add Laravel Pint (#53835) * install Pint with custom configuration - use an empty preset - set 1 explicit rule - ignore `/tests` (for now) * run Pint this rule ensures all chained methods on a new line are indented exactly once. this avoids arbitrarily aligning with some character or pattern in the first line line, while still giving us the readability of aligned subsequent lines. --------- Co-authored-by: Taylor Otwell --- composer.json | 1 + pint.json | 9 +++++ src/Illuminate/Auth/DatabaseUserProvider.php | 4 +- src/Illuminate/Auth/EloquentUserProvider.php | 4 +- .../Broadcasters/PusherBroadcaster.php | 2 +- src/Illuminate/Bus/Batch.php | 6 +-- .../Bus/DatabaseBatchRepository.php | 26 ++++++------- src/Illuminate/Cache/DatabaseLock.php | 10 ++--- src/Illuminate/Cache/DatabaseStore.php | 2 +- src/Illuminate/Cache/MemcachedStore.php | 2 +- .../Console/Scheduling/ManagesFrequencies.php | 26 ++++++------- src/Illuminate/Database/Connection.php | 2 +- .../Database/Console/DumpCommand.php | 8 ++-- .../Console/Migrations/StatusCommand.php | 20 +++++----- .../Database/Console/Seeds/SeedCommand.php | 4 +- .../Database/Console/WipeCommand.php | 12 +++--- src/Illuminate/Database/DatabaseManager.php | 6 +-- .../Eloquent/Concerns/GuardsAttributes.php | 4 +- .../Concerns/QueriesRelationships.php | 2 +- .../Eloquent/Factories/HasFactory.php | 4 +- .../Concerns/ComparesRelatedModels.php | 4 +- .../Concerns/InteractsWithPivotTable.php | 8 ++-- .../Eloquent/Relations/MorphPivot.php | 10 ++--- .../Database/Eloquent/Relations/MorphTo.php | 16 ++++---- .../Eloquent/Relations/MorphToMany.php | 8 ++-- .../DatabaseMigrationRepository.php | 16 ++++---- src/Illuminate/Database/Query/Builder.php | 38 +++++++++---------- src/Illuminate/Foundation/Application.php | 4 +- .../Foundation/Bus/PendingDispatch.php | 2 +- .../Console/BroadcastingInstallCommand.php | 2 +- src/Illuminate/Foundation/Console/Kernel.php | 4 +- .../Foundation/Console/RouteListCommand.php | 4 +- .../Foundation/Exceptions/Handler.php | 8 ++-- .../Foundation/Http/FormRequest.php | 4 +- src/Illuminate/Foundation/Http/Kernel.php | 6 +-- .../Providers/FoundationServiceProvider.php | 2 +- .../Providers/EventServiceProvider.php | 24 ++++++------ src/Illuminate/Http/Client/PendingRequest.php | 8 ++-- src/Illuminate/Http/RedirectResponse.php | 2 +- .../Http/Resources/CollectsResources.php | 4 +- src/Illuminate/Mail/Mailable.php | 30 +++++++-------- .../Mail/Transport/SesTransport.php | 8 ++-- .../Mail/Transport/SesV2Transport.php | 8 ++-- .../Channels/BroadcastChannel.php | 2 +- .../Notifications/Messages/MailMessage.php | 2 +- .../Notifications/NotificationSender.php | 8 ++-- src/Illuminate/Process/PendingProcess.php | 2 +- src/Illuminate/Process/Pipe.php | 28 +++++++------- src/Illuminate/Process/Pool.php | 2 +- src/Illuminate/Queue/CallQueuedHandler.php | 20 +++++----- src/Illuminate/Queue/DatabaseQueue.php | 26 ++++++------- src/Illuminate/Queue/QueueManager.php | 4 +- ...eatesRegularExpressionRouteConstraints.php | 4 +- src/Illuminate/Routing/Route.php | 2 +- src/Illuminate/Routing/Router.php | 30 +++++++-------- .../Session/DatabaseSessionHandler.php | 2 +- src/Illuminate/Session/FileSessionHandler.php | 8 ++-- .../Session/Middleware/StartSession.php | 4 +- src/Illuminate/Support/Composer.php | 12 +++--- src/Illuminate/Support/DefaultProviders.php | 6 +-- src/Illuminate/Support/Facades/Bus.php | 2 +- .../Support/Testing/Fakes/EventFake.php | 2 +- .../Constraints/NotSoftDeletedInDatabase.php | 6 +-- .../Constraints/SoftDeletedInDatabase.php | 6 +-- src/Illuminate/Testing/PendingCommand.php | 16 ++++---- src/Illuminate/Validation/Validator.php | 2 +- .../View/Compilers/BladeCompiler.php | 14 +++---- .../View/Compilers/ComponentTagCompiler.php | 16 ++++---- src/Illuminate/View/ComponentAttributeBag.php | 12 +++--- 69 files changed, 311 insertions(+), 301 deletions(-) create mode 100644 pint.json diff --git a/composer.json b/composer.json index f39a7a8229a3..76e2d34ad034 100644 --- a/composer.json +++ b/composer.json @@ -104,6 +104,7 @@ "fakerphp/faker": "^1.24", "guzzlehttp/promises": "^2.0.3", "guzzlehttp/psr7": "^2.4", + "laravel/pint": "^1.18", "league/flysystem-aws-s3-v3": "^3.25.1", "league/flysystem-ftp": "^3.25.1", "league/flysystem-path-prefixing": "^3.25.1", diff --git a/pint.json b/pint.json new file mode 100644 index 000000000000..304eebba7ebd --- /dev/null +++ b/pint.json @@ -0,0 +1,9 @@ +{ + "preset": "empty", + "rules": { + "method_chaining_indentation": true + }, + "exclude": [ + "tests" + ] +} diff --git a/src/Illuminate/Auth/DatabaseUserProvider.php b/src/Illuminate/Auth/DatabaseUserProvider.php index aaaafd8a8b45..def86b346a55 100755 --- a/src/Illuminate/Auth/DatabaseUserProvider.php +++ b/src/Illuminate/Auth/DatabaseUserProvider.php @@ -87,8 +87,8 @@ public function retrieveByToken($identifier, #[\SensitiveParameter] $token) public function updateRememberToken(UserContract $user, #[\SensitiveParameter] $token) { $this->connection->table($this->table) - ->where($user->getAuthIdentifierName(), $user->getAuthIdentifier()) - ->update([$user->getRememberTokenName() => $token]); + ->where($user->getAuthIdentifierName(), $user->getAuthIdentifier()) + ->update([$user->getRememberTokenName() => $token]); } /** diff --git a/src/Illuminate/Auth/EloquentUserProvider.php b/src/Illuminate/Auth/EloquentUserProvider.php index 77c8fef712b1..dc7a21ecac5d 100755 --- a/src/Illuminate/Auth/EloquentUserProvider.php +++ b/src/Illuminate/Auth/EloquentUserProvider.php @@ -55,8 +55,8 @@ public function retrieveById($identifier) $model = $this->createModel(); return $this->newModelQuery($model) - ->where($model->getAuthIdentifierName(), $identifier) - ->first(); + ->where($model->getAuthIdentifierName(), $identifier) + ->first(); } /** diff --git a/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php b/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php index 2799de29a8fa..962d814183a8 100644 --- a/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php +++ b/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php @@ -135,7 +135,7 @@ protected function decodePusherResponse($request, $response) } return response()->json(json_decode($response, true)) - ->withCallback($request->callback); + ->withCallback($request->callback); } /** diff --git a/src/Illuminate/Bus/Batch.php b/src/Illuminate/Bus/Batch.php index d551abb4e19e..bcfb898cb940 100644 --- a/src/Illuminate/Bus/Batch.php +++ b/src/Illuminate/Bus/Batch.php @@ -171,9 +171,9 @@ public function add($jobs) return with($this->prepareBatchedChain($job), function ($chain) { return $chain->first() - ->allOnQueue($this->options['queue'] ?? null) - ->allOnConnection($this->options['connection'] ?? null) - ->chain($chain->slice(1)->values()->all()); + ->allOnQueue($this->options['queue'] ?? null) + ->allOnConnection($this->options['connection'] ?? null) + ->chain($chain->slice(1)->values()->all()); }); } else { $job->withBatchId($this->id); diff --git a/src/Illuminate/Bus/DatabaseBatchRepository.php b/src/Illuminate/Bus/DatabaseBatchRepository.php index 2e0c7c68a9e6..31bd39878c57 100644 --- a/src/Illuminate/Bus/DatabaseBatchRepository.php +++ b/src/Illuminate/Bus/DatabaseBatchRepository.php @@ -58,14 +58,14 @@ public function __construct(BatchFactory $factory, Connection $connection, strin public function get($limit = 50, $before = null) { return $this->connection->table($this->table) - ->orderByDesc('id') - ->take($limit) - ->when($before, fn ($q) => $q->where('id', '<', $before)) - ->get() - ->map(function ($batch) { - return $this->toBatch($batch); - }) - ->all(); + ->orderByDesc('id') + ->take($limit) + ->when($before, fn ($q) => $q->where('id', '<', $before)) + ->get() + ->map(function ($batch) { + return $this->toBatch($batch); + }) + ->all(); } /** @@ -77,9 +77,9 @@ public function get($limit = 50, $before = null) public function find(string $batchId) { $batch = $this->connection->table($this->table) - ->useWritePdo() - ->where('id', $batchId) - ->first(); + ->useWritePdo() + ->where('id', $batchId) + ->first(); if ($batch) { return $this->toBatch($batch); @@ -185,8 +185,8 @@ protected function updateAtomicValues(string $batchId, Closure $callback) { return $this->connection->transaction(function () use ($batchId, $callback) { $batch = $this->connection->table($this->table)->where('id', $batchId) - ->lockForUpdate() - ->first(); + ->lockForUpdate() + ->first(); return is_null($batch) ? [] : tap($callback($batch), function ($values) use ($batchId) { $this->connection->table($this->table)->where('id', $batchId)->update($values); diff --git a/src/Illuminate/Cache/DatabaseLock.php b/src/Illuminate/Cache/DatabaseLock.php index 715d141c0d45..506696fdbd16 100644 --- a/src/Illuminate/Cache/DatabaseLock.php +++ b/src/Illuminate/Cache/DatabaseLock.php @@ -112,9 +112,9 @@ public function release() { if ($this->isOwnedByCurrentProcess()) { $this->connection->table($this->table) - ->where('key', $this->name) - ->where('owner', $this->owner) - ->delete(); + ->where('key', $this->name) + ->where('owner', $this->owner) + ->delete(); return true; } @@ -130,8 +130,8 @@ public function release() public function forceRelease() { $this->connection->table($this->table) - ->where('key', $this->name) - ->delete(); + ->where('key', $this->name) + ->delete(); } /** diff --git a/src/Illuminate/Cache/DatabaseStore.php b/src/Illuminate/Cache/DatabaseStore.php index 15ca30b322b7..56564c2988e3 100755 --- a/src/Illuminate/Cache/DatabaseStore.php +++ b/src/Illuminate/Cache/DatabaseStore.php @@ -263,7 +263,7 @@ protected function incrementOrDecrement($key, $value, Closure $callback) $prefixed = $this->prefix.$key; $cache = $this->table()->where('key', $prefixed) - ->lockForUpdate()->first(); + ->lockForUpdate()->first(); // If there is no value in the cache, we will return false here. Otherwise the // value will be decrypted and we will proceed with this function to either diff --git a/src/Illuminate/Cache/MemcachedStore.php b/src/Illuminate/Cache/MemcachedStore.php index 88198d9222bf..5197c2df71f5 100755 --- a/src/Illuminate/Cache/MemcachedStore.php +++ b/src/Illuminate/Cache/MemcachedStore.php @@ -45,7 +45,7 @@ public function __construct($memcached, $prefix = '') $this->memcached = $memcached; $this->onVersionThree = (new ReflectionMethod('Memcached', 'getMulti')) - ->getNumberOfParameters() == 2; + ->getNumberOfParameters() == 2; } /** diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index 105334e01b43..619d852e4817 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -391,7 +391,7 @@ protected function hourBasedSchedule($minutes, $hours) $hours = is_array($hours) ? implode(',', $hours) : $hours; return $this->spliceIntoPosition(1, $minutes) - ->spliceIntoPosition(2, $hours); + ->spliceIntoPosition(2, $hours); } /** @@ -492,8 +492,8 @@ public function sundays() public function weekly() { return $this->spliceIntoPosition(1, 0) - ->spliceIntoPosition(2, 0) - ->spliceIntoPosition(5, 0); + ->spliceIntoPosition(2, 0) + ->spliceIntoPosition(5, 0); } /** @@ -518,8 +518,8 @@ public function weeklyOn($dayOfWeek, $time = '0:0') public function monthly() { return $this->spliceIntoPosition(1, 0) - ->spliceIntoPosition(2, 0) - ->spliceIntoPosition(3, 1); + ->spliceIntoPosition(2, 0) + ->spliceIntoPosition(3, 1); } /** @@ -574,9 +574,9 @@ public function lastDayOfMonth($time = '0:0') public function quarterly() { return $this->spliceIntoPosition(1, 0) - ->spliceIntoPosition(2, 0) - ->spliceIntoPosition(3, 1) - ->spliceIntoPosition(4, '1-12/3'); + ->spliceIntoPosition(2, 0) + ->spliceIntoPosition(3, 1) + ->spliceIntoPosition(4, '1-12/3'); } /** @@ -591,7 +591,7 @@ public function quarterlyOn($dayOfQuarter = 1, $time = '0:0') $this->dailyAt($time); return $this->spliceIntoPosition(3, $dayOfQuarter) - ->spliceIntoPosition(4, '1-12/3'); + ->spliceIntoPosition(4, '1-12/3'); } /** @@ -602,9 +602,9 @@ public function quarterlyOn($dayOfQuarter = 1, $time = '0:0') public function yearly() { return $this->spliceIntoPosition(1, 0) - ->spliceIntoPosition(2, 0) - ->spliceIntoPosition(3, 1) - ->spliceIntoPosition(4, 1); + ->spliceIntoPosition(2, 0) + ->spliceIntoPosition(3, 1) + ->spliceIntoPosition(4, 1); } /** @@ -620,7 +620,7 @@ public function yearlyOn($month = 1, $dayOfMonth = 1, $time = '0:0') $this->dailyAt($time); return $this->spliceIntoPosition(3, $dayOfMonth) - ->spliceIntoPosition(4, $month); + ->spliceIntoPosition(4, $month); } /** diff --git a/src/Illuminate/Database/Connection.php b/src/Illuminate/Database/Connection.php index 692dfdee2f67..64f2eb25bf2b 100755 --- a/src/Illuminate/Database/Connection.php +++ b/src/Illuminate/Database/Connection.php @@ -467,7 +467,7 @@ public function cursor($query, $bindings = [], $useReadPdo = true) // mode and prepare the bindings for the query. Once that's done we will be // ready to execute the query against the database and return the cursor. $statement = $this->prepared($this->getPdoForSelect($useReadPdo) - ->prepare($query)); + ->prepare($query)); $this->bindValues( $statement, $this->prepareBindings($bindings) diff --git a/src/Illuminate/Database/Console/DumpCommand.php b/src/Illuminate/Database/Console/DumpCommand.php index 64148e90f9ac..b27d6c66a93c 100644 --- a/src/Illuminate/Database/Console/DumpCommand.php +++ b/src/Illuminate/Database/Console/DumpCommand.php @@ -77,10 +77,10 @@ protected function schemaState(Connection $connection) $migrationTable = is_array($migrations) ? ($migrations['table'] ?? 'migrations') : $migrations; return $connection->getSchemaState() - ->withMigrationTable($migrationTable) - ->handleOutputUsing(function ($type, $buffer) { - $this->output->write($buffer); - }); + ->withMigrationTable($migrationTable) + ->handleOutputUsing(function ($type, $buffer) { + $this->output->write($buffer); + }); } /** diff --git a/src/Illuminate/Database/Console/Migrations/StatusCommand.php b/src/Illuminate/Database/Console/Migrations/StatusCommand.php index 191983288739..378c4a720d26 100644 --- a/src/Illuminate/Database/Console/Migrations/StatusCommand.php +++ b/src/Illuminate/Database/Console/Migrations/StatusCommand.php @@ -101,19 +101,19 @@ public function handle() protected function getStatusFor(array $ran, array $batches) { return (new Collection($this->getAllMigrationFiles())) - ->map(function ($migration) use ($ran, $batches) { - $migrationName = $this->migrator->getMigrationName($migration); + ->map(function ($migration) use ($ran, $batches) { + $migrationName = $this->migrator->getMigrationName($migration); - $status = in_array($migrationName, $ran) - ? 'Ran' - : 'Pending'; + $status = in_array($migrationName, $ran) + ? 'Ran' + : 'Pending'; - if (in_array($migrationName, $ran)) { - $status = '['.$batches[$migrationName].'] '.$status; - } + if (in_array($migrationName, $ran)) { + $status = '['.$batches[$migrationName].'] '.$status; + } - return [$migrationName, $status]; - }); + return [$migrationName, $status]; + }); } /** diff --git a/src/Illuminate/Database/Console/Seeds/SeedCommand.php b/src/Illuminate/Database/Console/Seeds/SeedCommand.php index 0d4dbd5ad4fe..4ce2b0213129 100644 --- a/src/Illuminate/Database/Console/Seeds/SeedCommand.php +++ b/src/Illuminate/Database/Console/Seeds/SeedCommand.php @@ -96,8 +96,8 @@ protected function getSeeder() } return $this->laravel->make($class) - ->setContainer($this->laravel) - ->setCommand($this); + ->setContainer($this->laravel) + ->setCommand($this); } /** diff --git a/src/Illuminate/Database/Console/WipeCommand.php b/src/Illuminate/Database/Console/WipeCommand.php index f756dd121de0..754c9eea8414 100644 --- a/src/Illuminate/Database/Console/WipeCommand.php +++ b/src/Illuminate/Database/Console/WipeCommand.php @@ -69,8 +69,8 @@ public function handle() protected function dropAllTables($database) { $this->laravel['db']->connection($database) - ->getSchemaBuilder() - ->dropAllTables(); + ->getSchemaBuilder() + ->dropAllTables(); } /** @@ -82,8 +82,8 @@ protected function dropAllTables($database) protected function dropAllViews($database) { $this->laravel['db']->connection($database) - ->getSchemaBuilder() - ->dropAllViews(); + ->getSchemaBuilder() + ->dropAllViews(); } /** @@ -95,8 +95,8 @@ protected function dropAllViews($database) protected function dropAllTypes($database) { $this->laravel['db']->connection($database) - ->getSchemaBuilder() - ->dropAllTypes(); + ->getSchemaBuilder() + ->dropAllTypes(); } /** diff --git a/src/Illuminate/Database/DatabaseManager.php b/src/Illuminate/Database/DatabaseManager.php index 6f8867c4e51d..34ba2cc01bd9 100755 --- a/src/Illuminate/Database/DatabaseManager.php +++ b/src/Illuminate/Database/DatabaseManager.php @@ -228,7 +228,7 @@ protected function configuration($name) } return (new ConfigurationUrlParser) - ->parseConfiguration($config); + ->parseConfiguration($config); } /** @@ -374,8 +374,8 @@ protected function refreshPdoConnections($name) ); return $this->connections[$name] - ->setPdo($fresh->getRawPdo()) - ->setReadPdo($fresh->getRawReadPdo()); + ->setPdo($fresh->getRawPdo()) + ->setReadPdo($fresh->getRawReadPdo()); } /** diff --git a/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php b/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php index a81337729c7f..67229b4a0332 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php +++ b/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php @@ -220,8 +220,8 @@ protected function isGuardableColumn($key) if (! isset(static::$guardableColumns[get_class($this)])) { $columns = $this->getConnection() - ->getSchemaBuilder() - ->getColumnListing($this->getTable()); + ->getSchemaBuilder() + ->getColumnListing($this->getTable()); if (empty($columns)) { return true; diff --git a/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php b/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php index 56d116454621..1e602ff35cb8 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php +++ b/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php @@ -257,7 +257,7 @@ public function hasMorph($relation, $types, $operator = '>=', $count = 1, $boole } $query->where($this->qualifyColumn($relation->getMorphType()), '=', (new $type)->getMorphClass()) - ->whereHas($belongsTo, $callback, $operator, $count); + ->whereHas($belongsTo, $callback, $operator, $count); }); } }, null, null, $boolean); diff --git a/src/Illuminate/Database/Eloquent/Factories/HasFactory.php b/src/Illuminate/Database/Eloquent/Factories/HasFactory.php index 2078d9f025f3..ca37657def04 100644 --- a/src/Illuminate/Database/Eloquent/Factories/HasFactory.php +++ b/src/Illuminate/Database/Eloquent/Factories/HasFactory.php @@ -21,8 +21,8 @@ public static function factory($count = null, $state = []) $factory = static::newFactory() ?? Factory::factoryForModel(static::class); return $factory - ->count(is_numeric($count) ? $count : null) - ->state(is_callable($count) || is_array($count) ? $count : $state); + ->count(is_numeric($count) ? $count : null) + ->state(is_callable($count) || is_array($count) ? $count : $state); } /** diff --git a/src/Illuminate/Database/Eloquent/Relations/Concerns/ComparesRelatedModels.php b/src/Illuminate/Database/Eloquent/Relations/Concerns/ComparesRelatedModels.php index ca06698875e8..3dccf1310765 100644 --- a/src/Illuminate/Database/Eloquent/Relations/Concerns/ComparesRelatedModels.php +++ b/src/Illuminate/Database/Eloquent/Relations/Concerns/ComparesRelatedModels.php @@ -22,8 +22,8 @@ public function is($model) if ($match && $this instanceof SupportsPartialRelations && $this->isOneOfMany()) { return $this->query - ->whereKey($model->getKey()) - ->exists(); + ->whereKey($model->getKey()) + ->exists(); } return $match; diff --git a/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php b/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php index 034a7d7c8630..f09de9451eff 100644 --- a/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php +++ b/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php @@ -91,7 +91,7 @@ public function sync($ids, $detaching = true) // in this joining table. We'll spin through the given IDs, checking to see // if they exist in the array of current ones, and if not we will insert. $current = $this->getCurrentlyAttachedPivots() - ->pluck($this->relatedPivotKey)->all(); + ->pluck($this->relatedPivotKey)->all(); $records = $this->formatRecordsList($this->parseIds($ids)); @@ -240,9 +240,9 @@ public function updateExistingPivot($id, array $attributes, $touch = true) protected function updateExistingPivotUsingCustomClass($id, array $attributes, $touch) { $pivot = $this->getCurrentlyAttachedPivots() - ->where($this->foreignPivotKey, $this->parent->{$this->parentKey}) - ->where($this->relatedPivotKey, $this->parseId($id)) - ->first(); + ->where($this->foreignPivotKey, $this->parent->{$this->parentKey}) + ->where($this->relatedPivotKey, $this->parseId($id)) + ->first(); $updated = $pivot ? $pivot->fill($attributes)->isDirty() : false; diff --git a/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php b/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php index 6a3f395e73a6..566e198c9bea 100644 --- a/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php +++ b/src/Illuminate/Database/Eloquent/Relations/MorphPivot.php @@ -148,9 +148,9 @@ public function newQueryForRestoration($ids) $segments = explode(':', $ids); return $this->newQueryWithoutScopes() - ->where($segments[0], $segments[1]) - ->where($segments[2], $segments[3]) - ->where($segments[4], $segments[5]); + ->where($segments[0], $segments[1]) + ->where($segments[2], $segments[3]) + ->where($segments[4], $segments[5]); } /** @@ -174,8 +174,8 @@ protected function newQueryForCollectionRestoration(array $ids) $query->orWhere(function ($query) use ($segments) { return $query->where($segments[0], $segments[1]) - ->where($segments[2], $segments[3]) - ->where($segments[4], $segments[5]); + ->where($segments[2], $segments[3]) + ->where($segments[4], $segments[5]); }); } diff --git a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php index e743e93ea379..cc42984552a1 100644 --- a/src/Illuminate/Database/Eloquent/Relations/MorphTo.php +++ b/src/Illuminate/Database/Eloquent/Relations/MorphTo.php @@ -146,14 +146,14 @@ protected function getResultsByType($type) $ownerKey = $this->ownerKey ?? $instance->getKeyName(); $query = $this->replayMacros($instance->newQuery()) - ->mergeConstraintsFrom($this->getQuery()) - ->with(array_merge( - $this->getQuery()->getEagerLoads(), - (array) ($this->morphableEagerLoads[get_class($instance)] ?? []) - )) - ->withCount( - (array) ($this->morphableEagerLoadCounts[get_class($instance)] ?? []) - ); + ->mergeConstraintsFrom($this->getQuery()) + ->with(array_merge( + $this->getQuery()->getEagerLoads(), + (array) ($this->morphableEagerLoads[get_class($instance)] ?? []) + )) + ->withCount( + (array) ($this->morphableEagerLoadCounts[get_class($instance)] ?? []) + ); if ($callback = ($this->morphableConstraints[get_class($instance)] ?? null)) { $callback($query); diff --git a/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php b/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php index 9cb7445374d3..157202bccf21 100644 --- a/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php +++ b/src/Illuminate/Database/Eloquent/Relations/MorphToMany.php @@ -129,7 +129,7 @@ protected function getCurrentlyAttachedPivots() return parent::getCurrentlyAttachedPivots()->map(function ($record) { return $record instanceof MorphPivot ? $record->setMorphType($this->morphType) - ->setMorphClass($this->morphClass) + ->setMorphClass($this->morphClass) : $record; }); } @@ -161,9 +161,9 @@ public function newPivot(array $attributes = [], $exists = false) : MorphPivot::fromAttributes($this->parent, $attributes, $this->table, $exists); $pivot->setPivotKeys($this->foreignPivotKey, $this->relatedPivotKey) - ->setRelatedModel($this->related) - ->setMorphType($this->morphType) - ->setMorphClass($this->morphClass); + ->setRelatedModel($this->related) + ->setMorphType($this->morphType) + ->setMorphClass($this->morphClass); return $pivot; } diff --git a/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php b/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php index cf020d64db06..c5d5252854f1 100755 --- a/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php +++ b/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php @@ -48,9 +48,9 @@ public function __construct(Resolver $resolver, $table) public function getRan() { return $this->table() - ->orderBy('batch', 'asc') - ->orderBy('migration', 'asc') - ->pluck('migration')->all(); + ->orderBy('batch', 'asc') + ->orderBy('migration', 'asc') + ->pluck('migration')->all(); } /** @@ -64,8 +64,8 @@ public function getMigrations($steps) $query = $this->table()->where('batch', '>=', '1'); return $query->orderBy('batch', 'desc') - ->orderBy('migration', 'desc') - ->take($steps)->get()->all(); + ->orderBy('migration', 'desc') + ->take($steps)->get()->all(); } /** @@ -103,9 +103,9 @@ public function getLast() public function getMigrationBatches() { return $this->table() - ->orderBy('batch', 'asc') - ->orderBy('migration', 'asc') - ->pluck('batch', 'migration')->all(); + ->orderBy('batch', 'asc') + ->orderBy('migration', 'asc') + ->pluck('batch', 'migration')->all(); } /** diff --git a/src/Illuminate/Database/Query/Builder.php b/src/Illuminate/Database/Query/Builder.php index f166b28bbbfe..dd762d1dda88 100755 --- a/src/Illuminate/Database/Query/Builder.php +++ b/src/Illuminate/Database/Query/Builder.php @@ -2820,7 +2820,7 @@ public function forPageBeforeId($perPage = 15, $lastId = 0, $column = 'id') } return $this->orderBy($column, 'desc') - ->limit($perPage); + ->limit($perPage); } /** @@ -2840,7 +2840,7 @@ public function forPageAfterId($perPage = 15, $lastId = 0, $column = 'id') } return $this->orderBy($column, 'asc') - ->limit($perPage); + ->limit($perPage); } /** @@ -2873,10 +2873,10 @@ public function reorder($column = null, $direction = 'asc') protected function removeExistingOrdersFor($column) { return (new Collection($this->orders)) - ->reject(function ($order) use ($column) { - return isset($order['column']) - ? $order['column'] === $column : false; - })->values()->all(); + ->reject(function ($order) use ($column) { + return isset($order['column']) + ? $order['column'] === $column : false; + })->values()->all(); } /** @@ -3307,9 +3307,9 @@ protected function runPaginationCountQuery($columns = ['*']) $without = $this->unions ? ['unionOrders', 'unionLimit', 'unionOffset'] : ['columns', 'orders', 'limit', 'offset']; return $this->cloneWithout($without) - ->cloneWithoutBindings($this->unions ? ['unionOrder'] : ['select', 'order']) - ->setAggregate('count', $this->withoutSelectAliases($columns)) - ->get()->all(); + ->cloneWithoutBindings($this->unions ? ['unionOrder'] : ['select', 'order']) + ->setAggregate('count', $this->withoutSelectAliases($columns)) + ->get()->all(); } /** @@ -3320,7 +3320,7 @@ protected function runPaginationCountQuery($columns = ['*']) protected function cloneForPaginationCount() { return $this->cloneWithout(['orders', 'limit', 'offset']) - ->cloneWithoutBindings(['order']); + ->cloneWithoutBindings(['order']); } /** @@ -3628,9 +3628,9 @@ public function average($column) public function aggregate($function, $columns = ['*']) { $results = $this->cloneWithout($this->unions || $this->havings ? [] : ['columns']) - ->cloneWithoutBindings($this->unions || $this->havings ? [] : ['select']) - ->setAggregate($function, $columns) - ->get($columns); + ->cloneWithoutBindings($this->unions || $this->havings ? [] : ['select']) + ->setAggregate($function, $columns) + ->get($columns); if (! $results->isEmpty()) { return array_change_key_case((array) $results[0])['aggregate']; @@ -4243,12 +4243,12 @@ public function mergeBindings(self $query) public function cleanBindings(array $bindings) { return (new Collection($bindings)) - ->reject(function ($binding) { - return $binding instanceof ExpressionContract; - }) - ->map([$this, 'castBinding']) - ->values() - ->all(); + ->reject(function ($binding) { + return $binding instanceof ExpressionContract; + }) + ->map([$this, 'castBinding']) + ->values() + ->all(); } /** diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index f2944d73e79a..77bf7e2de6e1 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -840,12 +840,12 @@ public function registered($callback) public function registerConfiguredProviders() { $providers = (new Collection($this->make('config')->get('app.providers'))) - ->partition(fn ($provider) => str_starts_with($provider, 'Illuminate\\')); + ->partition(fn ($provider) => str_starts_with($provider, 'Illuminate\\')); $providers->splice(1, 0, [$this->make(PackageManifest::class)->providers()]); (new ProviderRepository($this, new Filesystem, $this->getCachedServicesPath())) - ->load($providers->collapse()->toArray()); + ->load($providers->collapse()->toArray()); $this->fireAppCallbacks($this->registeredCallbacks); } diff --git a/src/Illuminate/Foundation/Bus/PendingDispatch.php b/src/Illuminate/Foundation/Bus/PendingDispatch.php index d7a299d42f81..f7f2d0ed71bc 100644 --- a/src/Illuminate/Foundation/Bus/PendingDispatch.php +++ b/src/Illuminate/Foundation/Bus/PendingDispatch.php @@ -176,7 +176,7 @@ protected function shouldDispatch() } return (new UniqueLock(Container::getInstance()->make(Cache::class))) - ->acquire($this->job); + ->acquire($this->job); } /** diff --git a/src/Illuminate/Foundation/Console/BroadcastingInstallCommand.php b/src/Illuminate/Foundation/Console/BroadcastingInstallCommand.php index a1f7228830bd..93a8d6cf365a 100644 --- a/src/Illuminate/Foundation/Console/BroadcastingInstallCommand.php +++ b/src/Illuminate/Foundation/Console/BroadcastingInstallCommand.php @@ -200,7 +200,7 @@ protected function installNodeDependencies() } $command = Process::command(implode(' && ', $commands)) - ->path(base_path()); + ->path(base_path()); if (! windows_os()) { $command->tty(true); diff --git a/src/Illuminate/Foundation/Console/Kernel.php b/src/Illuminate/Foundation/Console/Kernel.php index 165855b80132..0ec8e312e254 100644 --- a/src/Illuminate/Foundation/Console/Kernel.php +++ b/src/Illuminate/Foundation/Console/Kernel.php @@ -538,8 +538,8 @@ protected function getArtisan() { if (is_null($this->artisan)) { $this->artisan = (new Artisan($this->app, $this->events, $this->app->version())) - ->resolveCommands($this->commands) - ->setContainerCommandLoader(); + ->resolveCommands($this->commands) + ->setContainerCommandLoader(); if ($this->symfonyDispatcher instanceof EventDispatcher) { $this->artisan->setDispatcher($this->symfonyDispatcher); diff --git a/src/Illuminate/Foundation/Console/RouteListCommand.php b/src/Illuminate/Foundation/Console/RouteListCommand.php index 569469e3ce55..104bff78af28 100644 --- a/src/Illuminate/Foundation/Console/RouteListCommand.php +++ b/src/Illuminate/Foundation/Console/RouteListCommand.php @@ -223,7 +223,7 @@ protected function isVendorRoute(Route $route) { if ($route->action['uses'] instanceof Closure) { $path = (new ReflectionFunction($route->action['uses'])) - ->getFileName(); + ->getFileName(); } elseif (is_string($route->action['uses']) && str_contains($route->action['uses'], 'SerializableClosure')) { return false; @@ -233,7 +233,7 @@ protected function isVendorRoute(Route $route) } $path = (new ReflectionClass($route->getControllerClass())) - ->getFileName(); + ->getFileName(); } else { return false; } diff --git a/src/Illuminate/Foundation/Exceptions/Handler.php b/src/Illuminate/Foundation/Exceptions/Handler.php index 5fb5f539110e..2f381d1ef6b7 100644 --- a/src/Illuminate/Foundation/Exceptions/Handler.php +++ b/src/Illuminate/Foundation/Exceptions/Handler.php @@ -483,10 +483,10 @@ public function stopIgnoring(array|string $exceptions) $exceptions = Arr::wrap($exceptions); $this->dontReport = (new Collection($this->dontReport)) - ->reject(fn ($ignored) => in_array($ignored, $exceptions))->values()->all(); + ->reject(fn ($ignored) => in_array($ignored, $exceptions))->values()->all(); $this->internalDontReport = (new Collection($this->internalDontReport)) - ->reject(fn ($ignored) => in_array($ignored, $exceptions))->values()->all(); + ->reject(fn ($ignored) => in_array($ignored, $exceptions))->values()->all(); return $this; } @@ -748,8 +748,8 @@ protected function convertValidationExceptionToResponse(ValidationException $e, protected function invalid($request, ValidationException $exception) { return redirect($exception->redirectTo ?? url()->previous()) - ->withInput(Arr::except($request->input(), $this->dontFlash)) - ->withErrors($exception->errors(), $request->input('_error_bag', $exception->errorBag)); + ->withInput(Arr::except($request->input(), $this->dontFlash)) + ->withErrors($exception->errors(), $request->input('_error_bag', $exception->errorBag)); } /** diff --git a/src/Illuminate/Foundation/Http/FormRequest.php b/src/Illuminate/Foundation/Http/FormRequest.php index 87a1e2048555..edff3035af98 100644 --- a/src/Illuminate/Foundation/Http/FormRequest.php +++ b/src/Illuminate/Foundation/Http/FormRequest.php @@ -166,8 +166,8 @@ protected function failedValidation(Validator $validator) $exception = $validator->getException(); throw (new $exception($validator)) - ->errorBag($this->errorBag) - ->redirectTo($this->getRedirectUrl()); + ->errorBag($this->errorBag) + ->redirectTo($this->getRedirectUrl()); } /** diff --git a/src/Illuminate/Foundation/Http/Kernel.php b/src/Illuminate/Foundation/Http/Kernel.php index 90c9fb010f4d..02c0f3fdbd95 100644 --- a/src/Illuminate/Foundation/Http/Kernel.php +++ b/src/Illuminate/Foundation/Http/Kernel.php @@ -171,9 +171,9 @@ protected function sendRequestThroughRouter($request) $this->bootstrap(); return (new Pipeline($this->app)) - ->send($request) - ->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware) - ->then($this->dispatchToRouter()); + ->send($request) + ->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware) + ->then($this->dispatchToRouter()); } /** diff --git a/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php b/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php index e993d714179d..fca2cc61057f 100644 --- a/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php +++ b/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php @@ -239,7 +239,7 @@ protected function registerExceptionTracking() $this->app->make('events')->listen(MessageLogged::class, function ($event) { if (isset($event->context['exception'])) { $this->app->make(LoggedExceptionCollection::class) - ->push($event->context['exception']); + ->push($event->context['exception']); } }); } diff --git a/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php b/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php index 37e35477411d..788d6ed54b4b 100644 --- a/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php +++ b/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php @@ -146,18 +146,18 @@ public function shouldDiscoverEvents() public function discoverEvents() { return (new Collection($this->discoverEventsWithin())) - ->flatMap(function ($directory) { - return glob($directory, GLOB_ONLYDIR); - }) - ->reject(function ($directory) { - return ! is_dir($directory); - }) - ->reduce(function ($discovered, $directory) { - return array_merge_recursive( - $discovered, - DiscoverEvents::within($directory, $this->eventDiscoveryBasePath()) - ); - }, []); + ->flatMap(function ($directory) { + return glob($directory, GLOB_ONLYDIR); + }) + ->reject(function ($directory) { + return ! is_dir($directory); + }) + ->reduce(function ($discovered, $directory) { + return array_merge_recursive( + $discovered, + DiscoverEvents::within($directory, $this->eventDiscoveryBasePath()) + ); + }, []); } /** diff --git a/src/Illuminate/Http/Client/PendingRequest.php b/src/Illuminate/Http/Client/PendingRequest.php index 6ece4cc79dd6..839c6e6debd5 100644 --- a/src/Illuminate/Http/Client/PendingRequest.php +++ b/src/Illuminate/Http/Client/PendingRequest.php @@ -1326,10 +1326,10 @@ public function buildStubHandler() return function ($handler) { return function ($request, $options) use ($handler) { $response = ($this->stubCallbacks ?? new Collection) - ->map - ->__invoke((new Request($request))->withData($options['laravel_data']), $options) - ->filter() - ->first(); + ->map + ->__invoke((new Request($request))->withData($options['laravel_data']), $options) + ->filter() + ->first(); if (is_null($response)) { if ($this->preventStrayRequests) { diff --git a/src/Illuminate/Http/RedirectResponse.php b/src/Illuminate/Http/RedirectResponse.php index 5c506ba6b00b..6e4a9cde5b1f 100755 --- a/src/Illuminate/Http/RedirectResponse.php +++ b/src/Illuminate/Http/RedirectResponse.php @@ -169,7 +169,7 @@ protected function parseErrors($provider) public function withFragment($fragment) { return $this->withoutFragment() - ->setTargetUrl($this->getTargetUrl().'#'.Str::after($fragment, '#')); + ->setTargetUrl($this->getTargetUrl().'#'.Str::after($fragment, '#')); } /** diff --git a/src/Illuminate/Http/Resources/CollectsResources.php b/src/Illuminate/Http/Resources/CollectsResources.php index fd06cdcce8f6..c1bad66733c8 100644 --- a/src/Illuminate/Http/Resources/CollectsResources.php +++ b/src/Illuminate/Http/Resources/CollectsResources.php @@ -80,8 +80,8 @@ public function jsonOptions() } return (new ReflectionClass($collects)) - ->newInstanceWithoutConstructor() - ->jsonOptions(); + ->newInstanceWithoutConstructor() + ->jsonOptions(); } /** diff --git a/src/Illuminate/Mail/Mailable.php b/src/Illuminate/Mail/Mailable.php index 70ccb3477d00..f517b803dce6 100644 --- a/src/Illuminate/Mail/Mailable.php +++ b/src/Illuminate/Mail/Mailable.php @@ -205,12 +205,12 @@ public function send($mailer) return $mailer->send($this->buildView(), $this->buildViewData(), function ($message) { $this->buildFrom($message) - ->buildRecipients($message) - ->buildSubject($message) - ->buildTags($message) - ->buildMetadata($message) - ->runCallbacks($message) - ->buildAttachments($message); + ->buildRecipients($message) + ->buildSubject($message) + ->buildTags($message) + ->buildMetadata($message) + ->runCallbacks($message) + ->buildAttachments($message); }); }); } @@ -262,10 +262,10 @@ public function later($delay, Queue $queue) protected function newQueuedJob() { return Container::getInstance()->make(SendQueuedMailable::class, ['mailable' => $this]) - ->through(array_merge( - method_exists($this, 'middleware') ? $this->middleware() : [], - $this->middleware ?? [] - )); + ->through(array_merge( + method_exists($this, 'middleware') ? $this->middleware() : [], + $this->middleware ?? [] + )); } /** @@ -966,9 +966,9 @@ public function attach($file, array $options = []) } $this->attachments = (new Collection($this->attachments)) - ->push(compact('file', 'options')) - ->unique('file') - ->all(); + ->push(compact('file', 'options')) + ->unique('file') + ->all(); return $this; } @@ -1048,8 +1048,8 @@ private function hasEnvelopeAttachment($attachment, $options = []) $attachments = $this->attachments(); return (new Collection(is_object($attachments) ? [$attachments] : $attachments)) - ->map(fn ($attached) => $attached instanceof Attachable ? $attached->toMailAttachment() : $attached) - ->contains(fn ($attached) => $attached->isEquivalent($attachment, $options)); + ->map(fn ($attached) => $attached instanceof Attachable ? $attached->toMailAttachment() : $attached) + ->contains(fn ($attached) => $attached->isEquivalent($attachment, $options)); } /** diff --git a/src/Illuminate/Mail/Transport/SesTransport.php b/src/Illuminate/Mail/Transport/SesTransport.php index 2ab1af6d7eab..daa3be18991e 100644 --- a/src/Illuminate/Mail/Transport/SesTransport.php +++ b/src/Illuminate/Mail/Transport/SesTransport.php @@ -68,10 +68,10 @@ protected function doSend(SentMessage $message): void $options, [ 'Source' => $message->getEnvelope()->getSender()->toString(), 'Destinations' => (new Collection($message->getEnvelope()->getRecipients())) - ->map - ->toString() - ->values() - ->all(), + ->map + ->toString() + ->values() + ->all(), 'RawMessage' => [ 'Data' => $message->toString(), ], diff --git a/src/Illuminate/Mail/Transport/SesV2Transport.php b/src/Illuminate/Mail/Transport/SesV2Transport.php index 3bb2985365b3..ab47b44b3ea8 100644 --- a/src/Illuminate/Mail/Transport/SesV2Transport.php +++ b/src/Illuminate/Mail/Transport/SesV2Transport.php @@ -69,10 +69,10 @@ protected function doSend(SentMessage $message): void 'Source' => $message->getEnvelope()->getSender()->toString(), 'Destination' => [ 'ToAddresses' => (new Collection($message->getEnvelope()->getRecipients())) - ->map - ->toString() - ->values() - ->all(), + ->map + ->toString() + ->values() + ->all(), ], 'Content' => [ 'Raw' => [ diff --git a/src/Illuminate/Notifications/Channels/BroadcastChannel.php b/src/Illuminate/Notifications/Channels/BroadcastChannel.php index e1010afc9e19..14739d8eb9d8 100644 --- a/src/Illuminate/Notifications/Channels/BroadcastChannel.php +++ b/src/Illuminate/Notifications/Channels/BroadcastChannel.php @@ -45,7 +45,7 @@ public function send($notifiable, Notification $notification) if ($message instanceof BroadcastMessage) { $event->onConnection($message->connection) - ->onQueue($message->queue); + ->onQueue($message->queue); } return $this->events->dispatch($event); diff --git a/src/Illuminate/Notifications/Messages/MailMessage.php b/src/Illuminate/Notifications/Messages/MailMessage.php index f01ef667ef16..a80117a50178 100644 --- a/src/Illuminate/Notifications/Messages/MailMessage.php +++ b/src/Illuminate/Notifications/Messages/MailMessage.php @@ -404,7 +404,7 @@ public function render() $markdown = Container::getInstance()->make(Markdown::class); return $markdown->theme($this->theme ?: $markdown->getTheme()) - ->render($this->markdown, $this->data()); + ->render($this->markdown, $this->data()); } /** diff --git a/src/Illuminate/Notifications/NotificationSender.php b/src/Illuminate/Notifications/NotificationSender.php index 983f8b41476f..cea407f70b9a 100644 --- a/src/Illuminate/Notifications/NotificationSender.php +++ b/src/Illuminate/Notifications/NotificationSender.php @@ -228,10 +228,10 @@ protected function queueNotification($notifiables, $notification) $this->bus->dispatch( (new SendQueuedNotifications($notifiable, $notification, [$channel])) - ->onConnection($connection) - ->onQueue($queue) - ->delay(is_array($delay) ? ($delay[$channel] ?? null) : $delay) - ->through($middleware) + ->onConnection($connection) + ->onQueue($queue) + ->delay(is_array($delay) ? ($delay[$channel] ?? null) : $delay) + ->through($middleware) ); } } diff --git a/src/Illuminate/Process/PendingProcess.php b/src/Illuminate/Process/PendingProcess.php index 668385460ac2..7161dd5bfb8a 100644 --- a/src/Illuminate/Process/PendingProcess.php +++ b/src/Illuminate/Process/PendingProcess.php @@ -351,7 +351,7 @@ public function withFakeHandlers(array $fakeHandlers) protected function fakeFor(string $command) { return (new Collection($this->fakeHandlers)) - ->first(fn ($handler, $pattern) => $pattern === '*' || Str::is($pattern, $command)); + ->first(fn ($handler, $pattern) => $pattern === '*' || Str::is($pattern, $command)); } /** diff --git a/src/Illuminate/Process/Pipe.php b/src/Illuminate/Process/Pipe.php index 1803c7d251ce..06e7e16598e8 100644 --- a/src/Illuminate/Process/Pipe.php +++ b/src/Illuminate/Process/Pipe.php @@ -69,22 +69,22 @@ public function run(?callable $output = null) call_user_func($this->callback, $this); return (new Collection($this->pendingProcesses)) - ->reduce(function ($previousProcessResult, $pendingProcess, $key) use ($output) { - if (! $pendingProcess instanceof PendingProcess) { - throw new InvalidArgumentException('Process pipe must only contain pending processes.'); - } + ->reduce(function ($previousProcessResult, $pendingProcess, $key) use ($output) { + if (! $pendingProcess instanceof PendingProcess) { + throw new InvalidArgumentException('Process pipe must only contain pending processes.'); + } - if ($previousProcessResult && $previousProcessResult->failed()) { - return $previousProcessResult; - } + if ($previousProcessResult && $previousProcessResult->failed()) { + return $previousProcessResult; + } - return $pendingProcess->when( - $previousProcessResult, - fn () => $pendingProcess->input($previousProcessResult->output()) - )->run(output: $output ? function ($type, $buffer) use ($key, $output) { - $output($type, $buffer, $key); - } : null); - }); + return $pendingProcess->when( + $previousProcessResult, + fn () => $pendingProcess->input($previousProcessResult->output()) + )->run(output: $output ? function ($type, $buffer) use ($key, $output) { + $output($type, $buffer, $key); + } : null); + }); } /** diff --git a/src/Illuminate/Process/Pool.php b/src/Illuminate/Process/Pool.php index e5271377d201..1a98a8541a57 100644 --- a/src/Illuminate/Process/Pool.php +++ b/src/Illuminate/Process/Pool.php @@ -79,7 +79,7 @@ public function start(?callable $output = null) $output($type, $buffer, $key); } : null)]; }) - ->all() + ->all() ); } diff --git a/src/Illuminate/Queue/CallQueuedHandler.php b/src/Illuminate/Queue/CallQueuedHandler.php index 46a2c1e08f83..12f49b495152 100644 --- a/src/Illuminate/Queue/CallQueuedHandler.php +++ b/src/Illuminate/Queue/CallQueuedHandler.php @@ -117,16 +117,16 @@ protected function dispatchThroughMiddleware(Job $job, $command) } return (new Pipeline($this->container))->send($command) - ->through(array_merge(method_exists($command, 'middleware') ? $command->middleware() : [], $command->middleware ?? [])) - ->then(function ($command) use ($job) { - if ($command instanceof ShouldBeUniqueUntilProcessing) { - $this->ensureUniqueJobLockIsReleased($command); - } - - return $this->dispatcher->dispatchNow( - $command, $this->resolveHandler($job, $command) - ); - }); + ->through(array_merge(method_exists($command, 'middleware') ? $command->middleware() : [], $command->middleware ?? [])) + ->then(function ($command) use ($job) { + if ($command instanceof ShouldBeUniqueUntilProcessing) { + $this->ensureUniqueJobLockIsReleased($command); + } + + return $this->dispatcher->dispatchNow( + $command, $this->resolveHandler($job, $command) + ); + }); } /** diff --git a/src/Illuminate/Queue/DatabaseQueue.php b/src/Illuminate/Queue/DatabaseQueue.php index 213f99563484..41533f084217 100644 --- a/src/Illuminate/Queue/DatabaseQueue.php +++ b/src/Illuminate/Queue/DatabaseQueue.php @@ -76,8 +76,8 @@ public function __construct( public function size($queue = null) { return $this->database->table($this->table) - ->where('queue', $this->getQueue($queue)) - ->count(); + ->where('queue', $this->getQueue($queue)) + ->count(); } /** @@ -239,14 +239,14 @@ public function pop($queue = null) protected function getNextAvailableJob($queue) { $job = $this->database->table($this->table) - ->lock($this->getLockForPopping()) - ->where('queue', $this->getQueue($queue)) - ->where(function ($query) { - $this->isAvailable($query); - $this->isReservedButExpired($query); - }) - ->orderBy('id', 'asc') - ->first(); + ->lock($this->getLockForPopping()) + ->where('queue', $this->getQueue($queue)) + ->where(function ($query) { + $this->isAvailable($query); + $this->isReservedButExpired($query); + }) + ->orderBy('id', 'asc') + ->first(); return $job ? new DatabaseJobRecord((object) $job) : null; } @@ -293,7 +293,7 @@ protected function isAvailable($query) { $query->where(function ($query) { $query->whereNull('reserved_at') - ->where('available_at', '<=', $this->currentTime()); + ->where('available_at', '<=', $this->currentTime()); }); } @@ -392,8 +392,8 @@ public function deleteAndRelease($queue, $job, $delay) public function clear($queue) { return $this->database->table($this->table) - ->where('queue', $this->getQueue($queue)) - ->delete(); + ->where('queue', $this->getQueue($queue)) + ->delete(); } /** diff --git a/src/Illuminate/Queue/QueueManager.php b/src/Illuminate/Queue/QueueManager.php index a64e43345c9e..399b66bc8729 100755 --- a/src/Illuminate/Queue/QueueManager.php +++ b/src/Illuminate/Queue/QueueManager.php @@ -160,8 +160,8 @@ protected function resolve($name) } return $this->getConnector($config['driver']) - ->connect($config) - ->setConnectionName($name); + ->connect($config) + ->setConnectionName($name); } /** diff --git a/src/Illuminate/Routing/CreatesRegularExpressionRouteConstraints.php b/src/Illuminate/Routing/CreatesRegularExpressionRouteConstraints.php index 64e497986634..c17374cef7c6 100644 --- a/src/Illuminate/Routing/CreatesRegularExpressionRouteConstraints.php +++ b/src/Illuminate/Routing/CreatesRegularExpressionRouteConstraints.php @@ -90,7 +90,7 @@ public function whereIn($parameters, array $values) protected function assignExpressionToParameters($parameters, $expression) { return $this->where(Collection::wrap($parameters) - ->mapWithKeys(fn ($parameter) => [$parameter => $expression]) - ->all()); + ->mapWithKeys(fn ($parameter) => [$parameter => $expression]) + ->all()); } } diff --git a/src/Illuminate/Routing/Route.php b/src/Illuminate/Routing/Route.php index c710312d1202..050d3c39b13c 100755 --- a/src/Illuminate/Routing/Route.php +++ b/src/Illuminate/Routing/Route.php @@ -378,7 +378,7 @@ public function bind(Request $request) $this->compileRoute(); $this->parameters = (new RouteParameterBinder($this)) - ->parameters($request); + ->parameters($request); $this->originalParameters = $this->parameters; diff --git a/src/Illuminate/Routing/Router.php b/src/Illuminate/Routing/Router.php index 3665d910aa34..cea49ce721f9 100644 --- a/src/Illuminate/Routing/Router.php +++ b/src/Illuminate/Routing/Router.php @@ -259,8 +259,8 @@ public function fallback($action) public function redirect($uri, $destination, $status = 302) { return $this->any($uri, '\Illuminate\Routing\RedirectController') - ->defaults('destination', $destination) - ->defaults('status', $status); + ->defaults('destination', $destination) + ->defaults('status', $status); } /** @@ -288,12 +288,12 @@ public function permanentRedirect($uri, $destination) public function view($uri, $view, $data = [], $status = 200, array $headers = []) { return $this->match(['GET', 'HEAD'], $uri, '\Illuminate\Routing\ViewController') - ->setDefaults([ - 'view' => $view, - 'data' => $data, - 'status' => is_array($status) ? 200 : $status, - 'headers' => is_array($status) ? $status : $headers, - ]); + ->setDefaults([ + 'view' => $view, + 'data' => $data, + 'status' => is_array($status) ? 200 : $status, + 'headers' => is_array($status) ? $status : $headers, + ]); } /** @@ -669,8 +669,8 @@ protected function prependGroupController($class) public function newRoute($methods, $uri, $action) { return (new Route($methods, $uri, $action)) - ->setRouter($this) - ->setContainer($this->container); + ->setRouter($this) + ->setContainer($this->container); } /** @@ -802,11 +802,11 @@ protected function runRouteWithinStack(Route $route, Request $request) $middleware = $shouldSkipMiddleware ? [] : $this->gatherRouteMiddleware($route); return (new Pipeline($this->container)) - ->send($request) - ->through($middleware) - ->then(fn ($request) => $this->prepareResponse( - $request, $route->run() - )); + ->send($request) + ->through($middleware) + ->then(fn ($request) => $this->prepareResponse( + $request, $route->run() + )); } /** diff --git a/src/Illuminate/Session/DatabaseSessionHandler.php b/src/Illuminate/Session/DatabaseSessionHandler.php index f4c1e9441323..132f1e347246 100644 --- a/src/Illuminate/Session/DatabaseSessionHandler.php +++ b/src/Illuminate/Session/DatabaseSessionHandler.php @@ -192,7 +192,7 @@ protected function getDefaultPayload($data) return tap($payload, function (&$payload) { $this->addUserInformation($payload) - ->addRequestInformation($payload); + ->addRequestInformation($payload); }); } diff --git a/src/Illuminate/Session/FileSessionHandler.php b/src/Illuminate/Session/FileSessionHandler.php index 08b2d80bd72d..82fe2245384b 100644 --- a/src/Illuminate/Session/FileSessionHandler.php +++ b/src/Illuminate/Session/FileSessionHandler.php @@ -112,10 +112,10 @@ public function destroy($sessionId): bool public function gc($lifetime): int { $files = Finder::create() - ->in($this->path) - ->files() - ->ignoreDotFiles(true) - ->date('<= now - '.$lifetime.' seconds'); + ->in($this->path) + ->files() + ->ignoreDotFiles(true) + ->date('<= now - '.$lifetime.' seconds'); $deletedSessions = 0; diff --git a/src/Illuminate/Session/Middleware/StartSession.php b/src/Illuminate/Session/Middleware/StartSession.php index c6310984673f..c1ffbb84c3df 100644 --- a/src/Illuminate/Session/Middleware/StartSession.php +++ b/src/Illuminate/Session/Middleware/StartSession.php @@ -83,8 +83,8 @@ protected function handleRequestWhileBlocking(Request $request, $session, Closur : $this->manager->defaultRouteBlockLockSeconds(); $lock = $this->cache($this->manager->blockDriver()) - ->lock('session:'.$session->getId(), $lockFor) - ->betweenBlockedAttemptsSleepFor(50); + ->lock('session:'.$session->getId(), $lockFor) + ->betweenBlockedAttemptsSleepFor(50); try { $lock->block( diff --git a/src/Illuminate/Support/Composer.php b/src/Illuminate/Support/Composer.php index 856d7728d227..860c886faf06 100644 --- a/src/Illuminate/Support/Composer.php +++ b/src/Illuminate/Support/Composer.php @@ -69,9 +69,9 @@ public function requirePackages(array $packages, bool $dev = false, Closure|Outp 'require', ...$packages, ])) - ->when($dev, function ($command) { - $command->push('--dev'); - })->all(); + ->when($dev, function ($command) { + $command->push('--dev'); + })->all(); return 0 === $this->getProcess($command, ['COMPOSER_MEMORY_LIMIT' => '-1']) ->run( @@ -98,9 +98,9 @@ public function removePackages(array $packages, bool $dev = false, Closure|Outpu 'remove', ...$packages, ])) - ->when($dev, function ($command) { - $command->push('--dev'); - })->all(); + ->when($dev, function ($command) { + $command->push('--dev'); + })->all(); return 0 === $this->getProcess($command, ['COMPOSER_MEMORY_LIMIT' => '-1']) ->run( diff --git a/src/Illuminate/Support/DefaultProviders.php b/src/Illuminate/Support/DefaultProviders.php index 5c836c67f9b4..791e86072b75 100644 --- a/src/Illuminate/Support/DefaultProviders.php +++ b/src/Illuminate/Support/DefaultProviders.php @@ -86,9 +86,9 @@ public function replace(array $replacements) public function except(array $providers) { return new static((new Collection($this->providers)) - ->reject(fn ($p) => in_array($p, $providers)) - ->values() - ->toArray()); + ->reject(fn ($p) => in_array($p, $providers)) + ->values() + ->toArray()); } /** diff --git a/src/Illuminate/Support/Facades/Bus.php b/src/Illuminate/Support/Facades/Bus.php index e3155df5ae8a..337108f31d85 100644 --- a/src/Illuminate/Support/Facades/Bus.php +++ b/src/Illuminate/Support/Facades/Bus.php @@ -85,7 +85,7 @@ public static function dispatchChain($jobs) $jobs = is_array($jobs) ? $jobs : func_get_args(); return (new PendingChain(array_shift($jobs), $jobs)) - ->dispatch(); + ->dispatch(); } /** diff --git a/src/Illuminate/Support/Testing/Fakes/EventFake.php b/src/Illuminate/Support/Testing/Fakes/EventFake.php index 4334e5ccf5aa..7f226a786faf 100644 --- a/src/Illuminate/Support/Testing/Fakes/EventFake.php +++ b/src/Illuminate/Support/Testing/Fakes/EventFake.php @@ -87,7 +87,7 @@ public function assertListening($expectedEvent, $expectedListener) { foreach ($this->dispatcher->getListeners($expectedEvent) as $listenerClosure) { $actualListener = (new ReflectionFunction($listenerClosure)) - ->getStaticVariables()['listener']; + ->getStaticVariables()['listener']; $normalizedListener = $expectedListener; diff --git a/src/Illuminate/Testing/Constraints/NotSoftDeletedInDatabase.php b/src/Illuminate/Testing/Constraints/NotSoftDeletedInDatabase.php index 87cef8b6d02d..665a50588caf 100644 --- a/src/Illuminate/Testing/Constraints/NotSoftDeletedInDatabase.php +++ b/src/Illuminate/Testing/Constraints/NotSoftDeletedInDatabase.php @@ -59,9 +59,9 @@ public function __construct(Connection $database, array $data, string $deletedAt public function matches($table): bool { return $this->database->table($table) - ->where($this->data) - ->whereNull($this->deletedAtColumn) - ->exists(); + ->where($this->data) + ->whereNull($this->deletedAtColumn) + ->exists(); } /** diff --git a/src/Illuminate/Testing/Constraints/SoftDeletedInDatabase.php b/src/Illuminate/Testing/Constraints/SoftDeletedInDatabase.php index 0d14f83b6c67..c764d5f39c4e 100644 --- a/src/Illuminate/Testing/Constraints/SoftDeletedInDatabase.php +++ b/src/Illuminate/Testing/Constraints/SoftDeletedInDatabase.php @@ -61,9 +61,9 @@ public function __construct(Connection $database, array $data, string $deletedAt public function matches($table): bool { return $this->database->table($table) - ->where($this->data) - ->whereNotNull($this->deletedAtColumn) - ->exists(); + ->where($this->data) + ->whereNotNull($this->deletedAtColumn) + ->exists(); } /** diff --git a/src/Illuminate/Testing/PendingCommand.php b/src/Illuminate/Testing/PendingCommand.php index 0fc154612cb8..062d2a17738c 100644 --- a/src/Illuminate/Testing/PendingCommand.php +++ b/src/Illuminate/Testing/PendingCommand.php @@ -443,8 +443,8 @@ protected function mockConsoleOutput() private function createABufferedOutputMock() { $mock = Mockery::mock(BufferedOutput::class.'[doWrite]') - ->shouldAllowMockingProtectedMethods() - ->shouldIgnoreMissing(); + ->shouldAllowMockingProtectedMethods() + ->shouldIgnoreMissing(); if ($this->test->expectsOutput === false) { $mock->shouldReceive('doWrite')->never(); @@ -491,12 +491,12 @@ private function createABufferedOutputMock() foreach ($this->test->unexpectedOutputSubstrings as $text => $displayed) { $mock->shouldReceive('doWrite') - ->atLeast() - ->times(0) - ->withArgs(fn ($output) => str_contains($output, $text)) - ->andReturnUsing(function () use ($text) { - $this->test->unexpectedOutputSubstrings[$text] = true; - }); + ->atLeast() + ->times(0) + ->withArgs(fn ($output) => str_contains($output, $text)) + ->andReturnUsing(function () use ($text) { + $this->test->unexpectedOutputSubstrings[$text] = true; + }); } return $mock; diff --git a/src/Illuminate/Validation/Validator.php b/src/Illuminate/Validation/Validator.php index dff9a156fc19..cdba5179f5c2 100755 --- a/src/Illuminate/Validation/Validator.php +++ b/src/Illuminate/Validation/Validator.php @@ -1225,7 +1225,7 @@ public function addRules($rules) // of the explicit rules needed for the given data. For example the rule // names.* would get expanded to names.0, names.1, etc. for this data. $response = (new ValidationRuleParser($this->data)) - ->explode(ValidationRuleParser::filterConditionalRules($rules, $this->data)); + ->explode(ValidationRuleParser::filterConditionalRules($rules, $this->data)); $this->rules = array_merge_recursive( $this->rules, $response->rules diff --git a/src/Illuminate/View/Compilers/BladeCompiler.php b/src/Illuminate/View/Compilers/BladeCompiler.php index d7b79bfd3b4b..ba8a339145c2 100644 --- a/src/Illuminate/View/Compilers/BladeCompiler.php +++ b/src/Illuminate/View/Compilers/BladeCompiler.php @@ -331,8 +331,8 @@ public function render() }; $view = Container::getInstance() - ->make(ViewFactory::class) - ->make($component->resolveView(), $data); + ->make(ViewFactory::class) + ->make($component->resolveView(), $data); return tap($view->render(), function () use ($view, $deleteCachedView) { if ($deleteCachedView) { @@ -821,8 +821,8 @@ public function anonymousComponentPath(string $path, ?string $prefix = null) ]; Container::getInstance() - ->make(ViewFactory::class) - ->addNamespace($prefixHash, $path); + ->make(ViewFactory::class) + ->addNamespace($prefixHash, $path); } /** @@ -837,9 +837,9 @@ public function anonymousComponentNamespace(string $directory, ?string $prefix = $prefix ??= $directory; $this->anonymousComponentNamespaces[$prefix] = (new Stringable($directory)) - ->replace('/', '.') - ->trim('. ') - ->toString(); + ->replace('/', '.') + ->trim('. ') + ->toString(); } /** diff --git a/src/Illuminate/View/Compilers/ComponentTagCompiler.php b/src/Illuminate/View/Compilers/ComponentTagCompiler.php index 3de2755f2a7f..357bcd241f58 100644 --- a/src/Illuminate/View/Compilers/ComponentTagCompiler.php +++ b/src/Illuminate/View/Compilers/ComponentTagCompiler.php @@ -421,8 +421,8 @@ public function findClassByComponent(string $component) public function guessClassName(string $component) { $namespace = Container::getInstance() - ->make(Application::class) - ->getNamespace(); + ->make(Application::class) + ->getNamespace(); $class = $this->formatClassName($component); @@ -787,12 +787,12 @@ protected function escapeSingleQuotesOutsideOfPhpBlocks(string $value) protected function attributesToString(array $attributes, $escapeBound = true) { return (new Collection($attributes)) - ->map(function (string $value, string $attribute) use ($escapeBound) { - return $escapeBound && isset($this->boundAttributes[$attribute]) && $value !== 'true' && ! is_numeric($value) - ? "'{$attribute}' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute({$value})" - : "'{$attribute}' => {$value}"; - }) - ->implode(','); + ->map(function (string $value, string $attribute) use ($escapeBound) { + return $escapeBound && isset($this->boundAttributes[$attribute]) && $value !== 'true' && ! is_numeric($value) + ? "'{$attribute}' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute({$value})" + : "'{$attribute}' => {$value}"; + }) + ->implode(','); } /** diff --git a/src/Illuminate/View/ComponentAttributeBag.php b/src/Illuminate/View/ComponentAttributeBag.php index befc983b3d36..780d93deb51d 100644 --- a/src/Illuminate/View/ComponentAttributeBag.php +++ b/src/Illuminate/View/ComponentAttributeBag.php @@ -274,12 +274,12 @@ public function merge(array $attributeDefaults = [], $escape = true) }, $attributeDefaults); [$appendableAttributes, $nonAppendableAttributes] = (new Collection($this->attributes)) - ->partition(function ($value, $key) use ($attributeDefaults) { - return $key === 'class' || $key === 'style' || ( - isset($attributeDefaults[$key]) && - $attributeDefaults[$key] instanceof AppendableAttributeValue - ); - }); + ->partition(function ($value, $key) use ($attributeDefaults) { + return $key === 'class' || $key === 'style' || ( + isset($attributeDefaults[$key]) && + $attributeDefaults[$key] instanceof AppendableAttributeValue + ); + }); $attributes = $appendableAttributes->mapWithKeys(function ($value, $key) use ($attributeDefaults, $escape) { $defaultsValue = isset($attributeDefaults[$key]) && $attributeDefaults[$key] instanceof AppendableAttributeValue