diff --git a/src/Illuminate/Cache/CacheManager.php b/src/Illuminate/Cache/CacheManager.php index 5ae5b6a3358b..6f15b122b2a4 100755 --- a/src/Illuminate/Cache/CacheManager.php +++ b/src/Illuminate/Cache/CacheManager.php @@ -332,7 +332,7 @@ protected function setEventDispatcher(Repository $repository) */ public function refreshEventDispatcher() { - array_map([$this, 'setEventDispatcher'], $this->stores); + array_map($this->setEventDispatcher(...), $this->stores); } /** diff --git a/src/Illuminate/Cache/TagSet.php b/src/Illuminate/Cache/TagSet.php index 471dc679ce5f..8be559d849ae 100644 --- a/src/Illuminate/Cache/TagSet.php +++ b/src/Illuminate/Cache/TagSet.php @@ -40,7 +40,7 @@ public function __construct(Store $store, array $names = []) */ public function reset() { - array_walk($this->names, [$this, 'resetTag']); + array_walk($this->names, $this->resetTag(...)); } /** @@ -63,7 +63,7 @@ public function resetTag($name) */ public function flush() { - array_walk($this->names, [$this, 'flushTag']); + array_walk($this->names, $this->flushTag(...)); } /** @@ -93,7 +93,7 @@ public function getNamespace() */ protected function tagIds() { - return array_map([$this, 'tagId'], $this->names); + return array_map($this->tagId(...), $this->names); } /** diff --git a/src/Illuminate/Collections/Collection.php b/src/Illuminate/Collections/Collection.php index 150ccbe8b749..4532891ec4c1 100644 --- a/src/Illuminate/Collections/Collection.php +++ b/src/Illuminate/Collections/Collection.php @@ -232,7 +232,7 @@ public function doesntContain($key, $operator = null, $value = null) public function crossJoin(...$lists) { return new static(Arr::crossJoin( - $this->items, ...array_map([$this, 'getArrayableItems'], $lists) + $this->items, ...array_map($this->getArrayableItems(...), $lists) )); } diff --git a/src/Illuminate/Collections/Traits/EnumeratesValues.php b/src/Illuminate/Collections/Traits/EnumeratesValues.php index 10a55498edf2..d70529a08aa8 100644 --- a/src/Illuminate/Collections/Traits/EnumeratesValues.php +++ b/src/Illuminate/Collections/Traits/EnumeratesValues.php @@ -412,7 +412,7 @@ public function mapToGroups(callable $callback) { $groups = $this->mapToDictionary($callback); - return $groups->map([$this, 'make']); + return $groups->map($this->make(...)); } /** diff --git a/src/Illuminate/Console/Scheduling/ScheduleListCommand.php b/src/Illuminate/Console/Scheduling/ScheduleListCommand.php index cf42dc795f00..68758440888b 100644 --- a/src/Illuminate/Console/Scheduling/ScheduleListCommand.php +++ b/src/Illuminate/Console/Scheduling/ScheduleListCommand.php @@ -86,7 +86,7 @@ public function handle(Schedule $schedule) */ private function getCronExpressionSpacing($events) { - $rows = $events->map(fn ($event) => array_map('mb_strlen', preg_split("/\s+/", $event->expression))); + $rows = $events->map(fn ($event) => array_map(mb_strlen(...), preg_split("/\s+/", $event->expression))); return (new Collection($rows[0] ?? []))->keys()->map(fn ($key) => $rows->max($key))->all(); } diff --git a/src/Illuminate/Database/Grammar.php b/src/Illuminate/Database/Grammar.php index 8dd9bc353ef4..28c1a2f10f24 100755 --- a/src/Illuminate/Database/Grammar.php +++ b/src/Illuminate/Database/Grammar.php @@ -33,7 +33,7 @@ abstract class Grammar */ public function wrapArray(array $values) { - return array_map([$this, 'wrap'], $values); + return array_map($this->wrap(...), $values); } /** @@ -186,7 +186,7 @@ protected function isJsonSelector($value) */ public function columnize(array $columns) { - return implode(', ', array_map([$this, 'wrap'], $columns)); + return implode(', ', array_map($this->wrap(...), $columns)); } /** @@ -197,7 +197,7 @@ public function columnize(array $columns) */ public function parameterize(array $values) { - return implode(', ', array_map([$this, 'parameter'], $values)); + return implode(', ', array_map($this->parameter(...), $values)); } /** diff --git a/src/Illuminate/Database/Query/Builder.php b/src/Illuminate/Database/Query/Builder.php index 7c1aee90b66f..95c12734391e 100755 --- a/src/Illuminate/Database/Query/Builder.php +++ b/src/Illuminate/Database/Query/Builder.php @@ -4220,7 +4220,7 @@ public function addBinding($value, $type = 'where') if (is_array($value)) { $this->bindings[$type] = array_values(array_map( - [$this, 'castBinding'], + $this->castBinding(...), array_merge($this->bindings[$type], $value), )); } else { @@ -4270,7 +4270,7 @@ public function cleanBindings(array $bindings) ->reject(function ($binding) { return $binding instanceof ExpressionContract; }) - ->map([$this, 'castBinding']) + ->map($this->castBinding(...)) ->values() ->all(); } diff --git a/src/Illuminate/Database/Schema/Builder.php b/src/Illuminate/Database/Schema/Builder.php index 387eb618f23a..38cadfbd2794 100755 --- a/src/Illuminate/Database/Schema/Builder.php +++ b/src/Illuminate/Database/Schema/Builder.php @@ -239,7 +239,7 @@ public function getTypes() public function hasColumn($table, $column) { return in_array( - strtolower($column), array_map('strtolower', $this->getColumnListing($table)) + strtolower($column), array_map(strtolower(...), $this->getColumnListing($table)) ); } @@ -252,7 +252,7 @@ public function hasColumn($table, $column) */ public function hasColumns($table, array $columns) { - $tableColumns = array_map('strtolower', $this->getColumnListing($table)); + $tableColumns = array_map(strtolower(...), $this->getColumnListing($table)); foreach ($columns as $column) { if (! in_array(strtolower($column), $tableColumns)) { diff --git a/src/Illuminate/Foundation/AliasLoader.php b/src/Illuminate/Foundation/AliasLoader.php index 5146e443be97..d46748598d5a 100755 --- a/src/Illuminate/Foundation/AliasLoader.php +++ b/src/Illuminate/Foundation/AliasLoader.php @@ -164,7 +164,7 @@ public function register() */ protected function prependToLoaderStack() { - spl_autoload_register([$this, 'load'], true, true); + spl_autoload_register($this->load(...), true, true); } /** diff --git a/src/Illuminate/Foundation/Console/RouteListCommand.php b/src/Illuminate/Foundation/Console/RouteListCommand.php index d54aceb26456..929003613c52 100644 --- a/src/Illuminate/Foundation/Console/RouteListCommand.php +++ b/src/Illuminate/Foundation/Console/RouteListCommand.php @@ -299,7 +299,7 @@ protected function getHeaders() */ protected function getColumns() { - return array_map('strtolower', $this->headers); + return array_map(strtolower(...), $this->headers); } /** @@ -320,7 +320,7 @@ protected function parseColumns(array $columns) } } - return array_map('strtolower', $results); + return array_map(strtolower(...), $results); } /** diff --git a/src/Illuminate/Foundation/Exceptions/Renderer/Listener.php b/src/Illuminate/Foundation/Exceptions/Renderer/Listener.php index 325fad4c20ac..d5a71b7d9178 100644 --- a/src/Illuminate/Foundation/Exceptions/Renderer/Listener.php +++ b/src/Illuminate/Foundation/Exceptions/Renderer/Listener.php @@ -28,7 +28,7 @@ class Listener */ public function registerListeners(Dispatcher $events) { - $events->listen(QueryExecuted::class, [$this, 'onQueryExecuted']); + $events->listen(QueryExecuted::class, $this->onQueryExecuted(...)); $events->listen([JobProcessing::class, JobProcessed::class], function () { $this->queries = []; diff --git a/src/Illuminate/Foundation/Http/FormRequest.php b/src/Illuminate/Foundation/Http/FormRequest.php index 87a1e2048555..7c746f24c2f2 100644 --- a/src/Illuminate/Foundation/Http/FormRequest.php +++ b/src/Illuminate/Foundation/Http/FormRequest.php @@ -86,7 +86,7 @@ protected function getValidatorInstance() $factory = $this->container->make(ValidationFactory::class); if (method_exists($this, 'validator')) { - $validator = $this->container->call([$this, 'validator'], compact('factory')); + $validator = $this->container->call($this->validator(...), compact('factory')); } else { $validator = $this->createDefaultValidator($factory); } diff --git a/src/Illuminate/Http/Middleware/TrustProxies.php b/src/Illuminate/Http/Middleware/TrustProxies.php index 0a13ff79a361..6b1b6765dc43 100644 --- a/src/Illuminate/Http/Middleware/TrustProxies.php +++ b/src/Illuminate/Http/Middleware/TrustProxies.php @@ -77,7 +77,7 @@ protected function setTrustedProxyIpAddresses(Request $request) } $trustedIps = is_string($trustedIps) - ? array_map('trim', explode(',', $trustedIps)) + ? array_map(trim(...), explode(',', $trustedIps)) : $trustedIps; if (is_array($trustedIps)) { diff --git a/src/Illuminate/Mail/Mailable.php b/src/Illuminate/Mail/Mailable.php index 70ccb3477d00..287118726b94 100644 --- a/src/Illuminate/Mail/Mailable.php +++ b/src/Illuminate/Mail/Mailable.php @@ -1415,7 +1415,7 @@ public function assertDontSeeInHtml($string, $escape = true) */ public function assertSeeInOrderInHtml($strings, $escape = true) { - $strings = $escape ? array_map('e', $strings) : $strings; + $strings = $escape ? array_map(e(...), $strings) : $strings; [$html, $text] = $this->renderForAssertions(); diff --git a/src/Illuminate/Notifications/Messages/SimpleMessage.php b/src/Illuminate/Notifications/Messages/SimpleMessage.php index 254fd78ee137..82985aab0ecb 100644 --- a/src/Illuminate/Notifications/Messages/SimpleMessage.php +++ b/src/Illuminate/Notifications/Messages/SimpleMessage.php @@ -236,10 +236,10 @@ protected function formatLine($line) } if (is_array($line)) { - return implode(' ', array_map('trim', $line)); + return implode(' ', array_map(trim(...), $line)); } - return trim(implode(' ', array_map('trim', preg_split('/\\r\\n|\\r|\\n/', $line ?? '')))); + return trim(implode(' ', array_map(trim(...), preg_split('/\\r\\n|\\r|\\n/', $line ?? '')))); } /** diff --git a/src/Illuminate/Redis/Connections/PacksPhpRedisValues.php b/src/Illuminate/Redis/Connections/PacksPhpRedisValues.php index 4d27ff59aebd..6e337f4fe926 100644 --- a/src/Illuminate/Redis/Connections/PacksPhpRedisValues.php +++ b/src/Illuminate/Redis/Connections/PacksPhpRedisValues.php @@ -42,7 +42,7 @@ public function pack(array $values): array } if ($this->supportsPacking()) { - return array_map([$this->client, '_pack'], $values); + return array_map($this->client->_pack(...), $values); } if ($this->compressed()) { diff --git a/src/Illuminate/Redis/Connectors/PhpRedisConnector.php b/src/Illuminate/Redis/Connectors/PhpRedisConnector.php index 06618a2ff118..2103155af9e9 100644 --- a/src/Illuminate/Redis/Connectors/PhpRedisConnector.php +++ b/src/Illuminate/Redis/Connectors/PhpRedisConnector.php @@ -51,7 +51,7 @@ public function connectToCluster(array $config, array $clusterOptions, array $op $options = array_merge($options, $clusterOptions, Arr::pull($config, 'options', [])); return new PhpRedisClusterConnection($this->createRedisClusterInstance( - array_map([$this, 'buildClusterConnectionString'], $config), $options + array_map($this->buildClusterConnectionString(...), $config), $options )); } diff --git a/src/Illuminate/Routing/Router.php b/src/Illuminate/Routing/Router.php index 3665d910aa34..d10c0dff463f 100644 --- a/src/Illuminate/Routing/Router.php +++ b/src/Illuminate/Routing/Router.php @@ -306,7 +306,7 @@ public function view($uri, $view, $data = [], $status = 200, array $headers = [] */ public function match($methods, $uri, $action = null) { - return $this->addRoute(array_map('strtoupper', (array) $methods), $uri, $action); + return $this->addRoute(array_map(strtoupper(...), (array) $methods), $uri, $action); } /** diff --git a/src/Illuminate/Support/ConfigurationUrlParser.php b/src/Illuminate/Support/ConfigurationUrlParser.php index a1b933709236..b841b65e41c6 100644 --- a/src/Illuminate/Support/ConfigurationUrlParser.php +++ b/src/Illuminate/Support/ConfigurationUrlParser.php @@ -42,7 +42,7 @@ public function parseConfiguration($config) $rawComponents = $this->parseUrl($url); $decodedComponents = $this->parseStringsToNativeTypes( - array_map('rawurldecode', $rawComponents) + array_map(rawurldecode(...), $rawComponents) ); return array_merge( @@ -151,7 +151,7 @@ protected function parseUrl($url) protected function parseStringsToNativeTypes($value) { if (is_array($value)) { - return array_map([$this, 'parseStringsToNativeTypes'], $value); + return array_map($this->parseStringsToNativeTypes(...), $value); } if (! is_string($value)) { diff --git a/src/Illuminate/Support/Str.php b/src/Illuminate/Support/Str.php index 0d6e784f47e1..a217f9cf003d 100644 --- a/src/Illuminate/Support/Str.php +++ b/src/Illuminate/Support/Str.php @@ -1406,8 +1406,8 @@ public static function headline($value) $parts = explode(' ', $value); $parts = count($parts) > 1 - ? array_map([static::class, 'title'], $parts) - : array_map([static::class, 'title'], static::ucsplit(implode('_', $parts))); + ? array_map(static::title(...), $parts) + : array_map(static::title(...), static::ucsplit(implode('_', $parts))); $collapsed = static::replace(['-', '_', ' '], '_', implode('_', $parts)); diff --git a/src/Illuminate/Support/Testing/Fakes/ExceptionHandlerFake.php b/src/Illuminate/Support/Testing/Fakes/ExceptionHandlerFake.php index f359d6c185bc..67b0a65e8214 100644 --- a/src/Illuminate/Support/Testing/Fakes/ExceptionHandlerFake.php +++ b/src/Illuminate/Support/Testing/Fakes/ExceptionHandlerFake.php @@ -73,7 +73,7 @@ public function assertReported(Closure|string $exception) if (is_string($exception)) { Assert::assertTrue( - in_array($exception, array_map('get_class', $this->reported), true), + in_array($exception, array_map(get_class(...), $this->reported), true), $message, ); @@ -135,7 +135,7 @@ public function assertNothingReported() $this->reported, sprintf( 'The following exceptions were reported: %s.', - implode(', ', array_map('get_class', $this->reported)), + implode(', ', array_map(get_class(...), $this->reported)), ), ); } diff --git a/src/Illuminate/Testing/TestComponent.php b/src/Illuminate/Testing/TestComponent.php index 0965789b3854..62874d50ee21 100644 --- a/src/Illuminate/Testing/TestComponent.php +++ b/src/Illuminate/Testing/TestComponent.php @@ -61,7 +61,7 @@ public function assertSee($value, $escape = true) */ public function assertSeeInOrder(array $values, $escape = true) { - $values = $escape ? array_map('e', $values) : $values; + $values = $escape ? array_map(e(...), $values) : $values; PHPUnit::assertThat($values, new SeeInOrder($this->rendered)); @@ -93,7 +93,7 @@ public function assertSeeText($value, $escape = true) */ public function assertSeeTextInOrder(array $values, $escape = true) { - $values = $escape ? array_map('e', $values) : $values; + $values = $escape ? array_map(e(...), $values) : $values; PHPUnit::assertThat($values, new SeeInOrder(strip_tags($this->rendered))); diff --git a/src/Illuminate/Testing/TestResponse.php b/src/Illuminate/Testing/TestResponse.php index 87c50d0ad44c..268dd2bbbe4b 100644 --- a/src/Illuminate/Testing/TestResponse.php +++ b/src/Illuminate/Testing/TestResponse.php @@ -567,7 +567,7 @@ public function assertSee($value, $escape = true) { $value = Arr::wrap($value); - $values = $escape ? array_map('e', $value) : $value; + $values = $escape ? array_map(e(...), $value) : $value; foreach ($values as $value) { PHPUnit::withResponse($this)->assertStringContainsString((string) $value, $this->getContent()); @@ -596,7 +596,7 @@ public function assertSeeHtml($value) */ public function assertSeeInOrder(array $values, $escape = true) { - $values = $escape ? array_map('e', $values) : $values; + $values = $escape ? array_map(e(...), $values) : $values; PHPUnit::withResponse($this)->assertThat($values, new SeeInOrder($this->getContent())); @@ -625,7 +625,7 @@ public function assertSeeText($value, $escape = true) { $value = Arr::wrap($value); - $values = $escape ? array_map('e', $value) : $value; + $values = $escape ? array_map(e(...), $value) : $value; $content = strip_tags($this->getContent()); @@ -645,7 +645,7 @@ public function assertSeeText($value, $escape = true) */ public function assertSeeTextInOrder(array $values, $escape = true) { - $values = $escape ? array_map('e', $values) : $values; + $values = $escape ? array_map(e(...), $values) : $values; PHPUnit::withResponse($this)->assertThat($values, new SeeInOrder(strip_tags($this->getContent()))); @@ -663,7 +663,7 @@ public function assertDontSee($value, $escape = true) { $value = Arr::wrap($value); - $values = $escape ? array_map('e', $value) : $value; + $values = $escape ? array_map(e(...), $value) : $value; foreach ($values as $value) { PHPUnit::withResponse($this)->assertStringNotContainsString((string) $value, $this->getContent()); @@ -694,7 +694,7 @@ public function assertDontSeeText($value, $escape = true) { $value = Arr::wrap($value); - $values = $escape ? array_map('e', $value) : $value; + $values = $escape ? array_map(e(...), $value) : $value; $content = strip_tags($this->getContent()); diff --git a/src/Illuminate/Testing/TestView.php b/src/Illuminate/Testing/TestView.php index a31a814ab402..acbb7435efa2 100644 --- a/src/Illuminate/Testing/TestView.php +++ b/src/Illuminate/Testing/TestView.php @@ -144,7 +144,7 @@ public function assertSee($value, $escape = true) */ public function assertSeeInOrder(array $values, $escape = true) { - $values = $escape ? array_map('e', $values) : $values; + $values = $escape ? array_map(e(...), $values) : $values; PHPUnit::assertThat($values, new SeeInOrder($this->rendered)); @@ -176,7 +176,7 @@ public function assertSeeText($value, $escape = true) */ public function assertSeeTextInOrder(array $values, $escape = true) { - $values = $escape ? array_map('e', $values) : $values; + $values = $escape ? array_map(e(...), $values) : $values; PHPUnit::assertThat($values, new SeeInOrder(strip_tags($this->rendered))); diff --git a/src/Illuminate/Validation/Rules/File.php b/src/Illuminate/Validation/Rules/File.php index 63928e33c48e..00cbc6a39465 100644 --- a/src/Illuminate/Validation/Rules/File.php +++ b/src/Illuminate/Validation/Rules/File.php @@ -277,7 +277,7 @@ protected function buildValidationRules() $rules = array_merge($rules, $this->buildMimetypes()); if (! empty($this->allowedExtensions)) { - $rules[] = 'extensions:'.implode(',', array_map('strtolower', $this->allowedExtensions)); + $rules[] = 'extensions:'.implode(',', array_map(strtolower(...), $this->allowedExtensions)); } $rules[] = match (true) { diff --git a/src/Illuminate/Validation/ValidationRuleParser.php b/src/Illuminate/Validation/ValidationRuleParser.php index 0119b6d3a803..7001b17cc7e3 100644 --- a/src/Illuminate/Validation/ValidationRuleParser.php +++ b/src/Illuminate/Validation/ValidationRuleParser.php @@ -96,7 +96,7 @@ protected function explodeExplicitRule($rule, $attribute) } return array_map( - [$this, 'prepareRule'], + $this->prepareRule(...), $rule, array_fill((int) array_key_first($rule), count($rule), $attribute) ); diff --git a/src/Illuminate/Validation/Validator.php b/src/Illuminate/Validation/Validator.php index 66708190202c..900bdb3698a0 100755 --- a/src/Illuminate/Validation/Validator.php +++ b/src/Illuminate/Validation/Validator.php @@ -1304,7 +1304,7 @@ public function stopOnFirstFailure($stopOnFirstFailure = true) public function addExtensions(array $extensions) { if ($extensions) { - $keys = array_map([Str::class, 'snake'], array_keys($extensions)); + $keys = array_map(Str::snake(...), array_keys($extensions)); $extensions = array_combine($keys, array_values($extensions)); } @@ -1391,7 +1391,7 @@ public function addDependentExtension($rule, $extension) public function addReplacers(array $replacers) { if ($replacers) { - $keys = array_map([Str::class, 'snake'], array_keys($replacers)); + $keys = array_map(Str::snake(...), array_keys($replacers)); $replacers = array_combine($keys, array_values($replacers)); } diff --git a/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php b/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php index 56d1399e85dc..22076c87bfc4 100644 --- a/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php +++ b/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php @@ -25,7 +25,7 @@ trait CompilesComponents protected function compileComponent($expression) { [$component, $alias, $data] = str_contains($expression, ',') - ? array_map('trim', explode(',', trim($expression, '()'), 3)) + ['', '', ''] + ? array_map(trim(...), explode(',', trim($expression, '()'), 3)) + ['', '', ''] : [trim($expression, '()'), '', '']; $component = trim($component, '\'"'); diff --git a/src/Illuminate/View/FileViewFinder.php b/src/Illuminate/View/FileViewFinder.php index c2f49bd68bde..917661d96bf2 100755 --- a/src/Illuminate/View/FileViewFinder.php +++ b/src/Illuminate/View/FileViewFinder.php @@ -53,7 +53,7 @@ class FileViewFinder implements ViewFinderInterface public function __construct(Filesystem $files, array $paths, ?array $extensions = null) { $this->files = $files; - $this->paths = array_map([$this, 'resolvePath'], $paths); + $this->paths = array_map($this->resolvePath(...), $paths); if (isset($extensions)) { $this->extensions = $extensions;