From 877bd15c32dff4b1bf7356d76c717df423067a1a Mon Sep 17 00:00:00 2001 From: Perry van der Meer <11609290+PerryvanderMeer@users.noreply.github.com> Date: Mon, 9 Dec 2024 19:35:41 +0100 Subject: [PATCH] use first class callables --- src/Illuminate/Collections/Collection.php | 2 +- src/Illuminate/Container/Container.php | 2 +- src/Illuminate/Database/Concerns/CompilesJsonPaths.php | 2 +- src/Illuminate/Database/DatabaseTransactionsManager.php | 2 +- src/Illuminate/Database/Eloquent/Model.php | 2 +- src/Illuminate/Database/Migrations/Migrator.php | 2 +- src/Illuminate/Database/Query/Builder.php | 2 +- src/Illuminate/Database/Query/Grammars/PostgresGrammar.php | 2 +- src/Illuminate/Foundation/Console/AboutCommand.php | 4 ++-- src/Illuminate/Foundation/Console/PackageDiscoverCommand.php | 2 +- src/Illuminate/Process/FakeProcessDescription.php | 4 ++-- src/Illuminate/View/View.php | 2 +- 12 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Illuminate/Collections/Collection.php b/src/Illuminate/Collections/Collection.php index dddaafcdac6c..4bb5762c3b06 100644 --- a/src/Illuminate/Collections/Collection.php +++ b/src/Illuminate/Collections/Collection.php @@ -1789,7 +1789,7 @@ public function values() */ public function zip($items) { - $arrayableItems = array_map(fn ($items) => $this->getArrayableItems($items), func_get_args()); + $arrayableItems = array_map($this->getArrayableItems(...), func_get_args()); $params = array_merge([fn () => new static(func_get_args()), $this->items], $arrayableItems); diff --git a/src/Illuminate/Container/Container.php b/src/Illuminate/Container/Container.php index a0a3f870a5e0..a7650b759670 100755 --- a/src/Illuminate/Container/Container.php +++ b/src/Illuminate/Container/Container.php @@ -1154,7 +1154,7 @@ protected function resolveVariadicClass(ReflectionParameter $parameter) return $this->make($className); } - return array_map(fn ($abstract) => $this->resolve($abstract), $concrete); + return array_map($this->resolve(...), $concrete); } /** diff --git a/src/Illuminate/Database/Concerns/CompilesJsonPaths.php b/src/Illuminate/Database/Concerns/CompilesJsonPaths.php index fb629143745d..a8188ef7aaa3 100644 --- a/src/Illuminate/Database/Concerns/CompilesJsonPaths.php +++ b/src/Illuminate/Database/Concerns/CompilesJsonPaths.php @@ -36,7 +36,7 @@ protected function wrapJsonPath($value, $delimiter = '->') $value = preg_replace("/([\\\\]+)?\\'/", "''", $value); $jsonPath = (new Collection(explode($delimiter, $value))) - ->map(fn ($segment) => $this->wrapJsonPathSegment($segment)) + ->map($this->wrapJsonPathSegment(...)) ->join('.'); return "'$".(str_starts_with($jsonPath, '[') ? '' : '.').$jsonPath."'"; diff --git a/src/Illuminate/Database/DatabaseTransactionsManager.php b/src/Illuminate/Database/DatabaseTransactionsManager.php index ee2889a2d18a..d3e5ad82b586 100755 --- a/src/Illuminate/Database/DatabaseTransactionsManager.php +++ b/src/Illuminate/Database/DatabaseTransactionsManager.php @@ -186,7 +186,7 @@ protected function removeCommittedTransactionsThatAreChildrenOf(DatabaseTransact // also need to remove. We will recurse down the children of all removed transaction // instances until there are no more deeply nested child transactions for removal. $removedTransactions->each( - fn ($transaction) => $this->removeCommittedTransactionsThatAreChildrenOf($transaction) + $this->removeCommittedTransactionsThatAreChildrenOf(...) ); } diff --git a/src/Illuminate/Database/Eloquent/Model.php b/src/Illuminate/Database/Eloquent/Model.php index f39cd2894b9e..db4217339bbb 100644 --- a/src/Illuminate/Database/Eloquent/Model.php +++ b/src/Illuminate/Database/Eloquent/Model.php @@ -601,7 +601,7 @@ public function qualifyColumn($column) public function qualifyColumns($columns) { return (new BaseCollection($columns)) - ->map(fn ($column) => $this->qualifyColumn($column)) + ->map($this->qualifyColumn(...)) ->all(); } diff --git a/src/Illuminate/Database/Migrations/Migrator.php b/src/Illuminate/Database/Migrations/Migrator.php index 1a0d5dd9ea33..e628ede8d7f6 100755 --- a/src/Illuminate/Database/Migrations/Migrator.php +++ b/src/Illuminate/Database/Migrations/Migrator.php @@ -540,7 +540,7 @@ public function getMigrationFiles($paths) ->flatMap(fn ($path) => str_ends_with($path, '.php') ? [$path] : $this->files->glob($path.'/*_*.php')) ->filter() ->values() - ->keyBy(fn ($file) => $this->getMigrationName($file)) + ->keyBy($this->getMigrationName(...)) ->sortBy(fn ($file, $key) => $key) ->all(); } diff --git a/src/Illuminate/Database/Query/Builder.php b/src/Illuminate/Database/Query/Builder.php index 540905d2ec5e..fe8a0ec1c34a 100755 --- a/src/Illuminate/Database/Query/Builder.php +++ b/src/Illuminate/Database/Query/Builder.php @@ -4112,7 +4112,7 @@ protected function forSubQuery() public function getColumns() { return ! is_null($this->columns) - ? array_map(fn ($column) => $this->grammar->getValue($column), $this->columns) + ? array_map($this->grammar->getValue(...), $this->columns) : []; } diff --git a/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php b/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php index 2103f6c906fe..742a6f897ffe 100755 --- a/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php +++ b/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php @@ -737,7 +737,7 @@ protected function wrapJsonPathAttributes($path) $quote = func_num_args() === 2 ? func_get_arg(1) : "'"; return (new Collection($path)) - ->map(fn ($attribute) => $this->parseJsonPathArrayKeys($attribute)) + ->map($this->parseJsonPathArrayKeys(...)) ->collapse() ->map(function ($attribute) use ($quote) { return filter_var($attribute, FILTER_VALIDATE_INT) !== false diff --git a/src/Illuminate/Foundation/Console/AboutCommand.php b/src/Illuminate/Foundation/Console/AboutCommand.php index 02ec64c8525d..a705d119ccce 100644 --- a/src/Illuminate/Foundation/Console/AboutCommand.php +++ b/src/Illuminate/Foundation/Console/AboutCommand.php @@ -95,7 +95,7 @@ public function handle() ->filter(function ($data, $key) { return $this->option('only') ? in_array($this->toSearchKeyword($key), $this->sections()) : true; }) - ->pipe(fn ($data) => $this->display($data)); + ->pipe($this->display(...)); $this->newLine(); @@ -270,7 +270,7 @@ protected function sections() { return (new Collection(explode(',', $this->option('only') ?? ''))) ->filter() - ->map(fn ($only) => $this->toSearchKeyword($only)) + ->map($this->toSearchKeyword(...)) ->all(); } diff --git a/src/Illuminate/Foundation/Console/PackageDiscoverCommand.php b/src/Illuminate/Foundation/Console/PackageDiscoverCommand.php index 2cf4a5f5669b..42cc32807d05 100644 --- a/src/Illuminate/Foundation/Console/PackageDiscoverCommand.php +++ b/src/Illuminate/Foundation/Console/PackageDiscoverCommand.php @@ -38,7 +38,7 @@ public function handle(PackageManifest $manifest) (new Collection($manifest->manifest)) ->keys() - ->each(fn ($description) => $this->components->task($description)) + ->each($this->components->task(...)) ->whenNotEmpty(fn () => $this->newLine()); } } diff --git a/src/Illuminate/Process/FakeProcessDescription.php b/src/Illuminate/Process/FakeProcessDescription.php index b6a7f7a16a8d..8fa1a3104990 100644 --- a/src/Illuminate/Process/FakeProcessDescription.php +++ b/src/Illuminate/Process/FakeProcessDescription.php @@ -57,7 +57,7 @@ public function id(int $processId) public function output(array|string $output) { if (is_array($output)) { - (new Collection($output))->each(fn ($line) => $this->output($line)); + (new Collection($output))->each($this->output(...)); return $this; } @@ -76,7 +76,7 @@ public function output(array|string $output) public function errorOutput(array|string $output) { if (is_array($output)) { - (new Collection($output))->each(fn ($line) => $this->errorOutput($line)); + (new Collection($output))->each($this->errorOutput(...)); return $this; } diff --git a/src/Illuminate/View/View.php b/src/Illuminate/View/View.php index 7405b33d5fdc..699117bb7298 100755 --- a/src/Illuminate/View/View.php +++ b/src/Illuminate/View/View.php @@ -102,7 +102,7 @@ public function fragments(?array $fragments = null) { return is_null($fragments) ? $this->allFragments() - : (new Collection($fragments))->map(fn ($f) => $this->fragment($f))->implode(''); + : (new Collection($fragments))->map($this->fragment(...))->implode(''); } /**