diff --git a/system/CLI/BaseCommand.php b/system/CLI/BaseCommand.php index 86ba504feaa6..afeb80eb5267 100644 --- a/system/CLI/BaseCommand.php +++ b/system/CLI/BaseCommand.php @@ -163,7 +163,7 @@ public function showHelp() if ($this->arguments !== []) { CLI::newLine(); CLI::write(lang('CLI.helpArguments'), 'yellow'); - $length = max(array_map('strlen', array_keys($this->arguments))); + $length = max(array_map(strlen(...), array_keys($this->arguments))); foreach ($this->arguments as $argument => $description) { CLI::write(CLI::color($this->setPad($argument, $length, 2, 2), 'green') . $description); @@ -173,7 +173,7 @@ public function showHelp() if ($this->options !== []) { CLI::newLine(); CLI::write(lang('CLI.helpOptions'), 'yellow'); - $length = max(array_map('strlen', array_keys($this->options))); + $length = max(array_map(strlen(...), array_keys($this->options))); foreach ($this->options as $option => $description) { CLI::write(CLI::color($this->setPad($option, $length, 2, 2), 'green') . $description); diff --git a/system/CLI/CLI.php b/system/CLI/CLI.php index 7badf1807dcd..6adc9f839367 100644 --- a/system/CLI/CLI.php +++ b/system/CLI/CLI.php @@ -393,7 +393,7 @@ private static function isZeroOptions(array $options): void private static function printKeysAndValues(array $options): void { // +2 for the square brackets around the key - $keyMaxLength = max(array_map('mb_strwidth', array_keys($options))) + 2; + $keyMaxLength = max(array_map(mb_strwidth(...), array_keys($options))) + 2; foreach ($options as $key => $description) { $name = str_pad(' [' . $key . '] ', $keyMaxLength + 4, ' '); diff --git a/system/CLI/GeneratorTrait.php b/system/CLI/GeneratorTrait.php index 065197be5090..6a061a36b8b3 100644 --- a/system/CLI/GeneratorTrait.php +++ b/system/CLI/GeneratorTrait.php @@ -325,7 +325,7 @@ private function normalizeInputClassName(): string implode( '\\', array_map( - 'pascalize', + pascalize(...), explode('\\', str_replace('/', '\\', trim($class))) ) ), diff --git a/system/Commands/ListCommands.php b/system/Commands/ListCommands.php index 87c3e96b824a..3411b103430d 100644 --- a/system/Commands/ListCommands.php +++ b/system/Commands/ListCommands.php @@ -101,7 +101,7 @@ protected function listFull(array $commands) $groups[$command['group']][$title] = $command; } - $length = max(array_map('strlen', array_keys($commands))); + $length = max(array_map(strlen(...), array_keys($commands))); ksort($groups); diff --git a/system/Commands/Utilities/Routes.php b/system/Commands/Utilities/Routes.php index f9575c063973..9adcc1bc39e7 100644 --- a/system/Commands/Utilities/Routes.php +++ b/system/Commands/Utilities/Routes.php @@ -119,8 +119,8 @@ public function run(array $params) $route['route'], $routeName, $route['handler'], - implode(' ', array_map('class_basename', $filters['before'])), - implode(' ', array_map('class_basename', $filters['after'])), + implode(' ', array_map(class_basename(...), $filters['before'])), + implode(' ', array_map(class_basename(...), $filters['after'])), ]; } @@ -166,8 +166,8 @@ public function run(array $params) // There is no `AUTO` method, but it is intentional not to get route filters. $filters = $filterCollector->get('AUTO', $uriGenerator->get($routes[1])); - $routes[] = implode(' ', array_map('class_basename', $filters['before'])); - $routes[] = implode(' ', array_map('class_basename', $filters['after'])); + $routes[] = implode(' ', array_map(class_basename(...), $filters['before'])); + $routes[] = implode(' ', array_map(class_basename(...), $filters['after'])); } } diff --git a/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php b/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php index 0d426a3b1716..579969346637 100644 --- a/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php +++ b/system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php @@ -125,8 +125,8 @@ private function addFilters($routes) $filters['before'] = array_intersect($filtersLongest['before'], $filtersShortest['before']); $filters['after'] = array_intersect($filtersLongest['after'], $filtersShortest['after']); - $route['before'] = implode(' ', array_map('class_basename', $filters['before'])); - $route['after'] = implode(' ', array_map('class_basename', $filters['after'])); + $route['before'] = implode(' ', array_map(class_basename(...), $filters['before'])); + $route['after'] = implode(' ', array_map(class_basename(...), $filters['after'])); } return $routes; diff --git a/system/Cookie/Cookie.php b/system/Cookie/Cookie.php index 78dc44258eb9..01b10db19b65 100644 --- a/system/Cookie/Cookie.php +++ b/system/Cookie/Cookie.php @@ -283,7 +283,7 @@ public function getPrefixedName(): string $name .= $this->getName(); } else { $search = str_split(self::$reservedCharsList); - $replace = array_map('rawurlencode', $search); + $replace = array_map(rawurlencode(...), $search); $name .= str_replace($search, $replace, $this->getName()); } diff --git a/system/DataCaster/DataCaster.php b/system/DataCaster/DataCaster.php index 29de3987faa9..5a6786a03331 100644 --- a/system/DataCaster/DataCaster.php +++ b/system/DataCaster/DataCaster.php @@ -156,7 +156,7 @@ public function castAs(mixed $value, string $field, string $method = 'get'): mix // type[param, param2,param3] if (preg_match('/\A(.+)\[(.+)\]\z/', $type, $matches)) { $type = $matches[1]; - $params = array_map('trim', explode(',', $matches[2])); + $params = array_map(trim(...), explode(',', $matches[2])); } if ($isNullable && ! $this->strict) { diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index 6581dc7c5ac0..dce399bdefb5 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -1519,7 +1519,7 @@ public function tableExists(string $tableName, bool $cached = true): bool if (! empty($this->dataCache['table_names'])) { $key = array_search( strtolower($tableName), - array_map('strtolower', $this->dataCache['table_names']), + array_map(strtolower(...), $this->dataCache['table_names']), true ); diff --git a/system/Database/Forge.php b/system/Database/Forge.php index 797b685e861c..595cd6156b5f 100644 --- a/system/Database/Forge.php +++ b/system/Database/Forge.php @@ -306,7 +306,7 @@ public function dropDatabase(string $dbName): bool if (! empty($this->db->dataCache['db_names'])) { $key = array_search( strtolower($dbName), - array_map('strtolower', $this->db->dataCache['db_names']), + array_map(strtolower(...), $this->db->dataCache['db_names']), true ); if ($key !== false) { @@ -667,7 +667,7 @@ public function dropTable(string $tableName, bool $ifExists = false, bool $casca if ($query && ! empty($this->db->dataCache['table_names'])) { $key = array_search( strtolower($this->db->DBPrefix . $tableName), - array_map('strtolower', $this->db->dataCache['table_names']), + array_map(strtolower(...), $this->db->dataCache['table_names']), true ); @@ -729,7 +729,7 @@ public function renameTable(string $tableName, string $newTableName) if ($result && ! empty($this->db->dataCache['table_names'])) { $key = array_search( strtolower($this->db->DBPrefix . $tableName), - array_map('strtolower', $this->db->dataCache['table_names']), + array_map(strtolower(...), $this->db->dataCache['table_names']), true ); diff --git a/system/Database/MigrationRunner.php b/system/Database/MigrationRunner.php index 719d45c15592..055b8ba6eaf3 100644 --- a/system/Database/MigrationRunner.php +++ b/system/Database/MigrationRunner.php @@ -686,7 +686,7 @@ public function getBatches(): array ->get() ->getResultArray(); - return array_map('intval', array_column($batches, 'batch')); + return array_map(intval(...), array_column($batches, 'batch')); } /** diff --git a/system/Database/OCI8/Forge.php b/system/Database/OCI8/Forge.php index 69a42ed1dbeb..5a10363be769 100644 --- a/system/Database/OCI8/Forge.php +++ b/system/Database/OCI8/Forge.php @@ -202,7 +202,7 @@ protected function _processColumn(array $processedField): string $constraint = ' CHECK(' . $this->db->escapeIdentifiers($processedField['name']) . ' IN ' . $processedField['length'] . ')'; - $processedField['length'] = '(' . max(array_map('mb_strlen', explode("','", mb_substr($processedField['length'], 2, -2)))) . ')' . $constraint; + $processedField['length'] = '(' . max(array_map(mb_strlen(...), explode("','", mb_substr($processedField['length'], 2, -2)))) . ')' . $constraint; } elseif (isset($this->primaryKeys['fields']) && count($this->primaryKeys['fields']) === 1 && $processedField['name'] === $this->primaryKeys['fields'][0]) { $processedField['unique'] = ''; } diff --git a/system/Database/SQLite3/Forge.php b/system/Database/SQLite3/Forge.php index 32e447829c29..48e9abcc425c 100644 --- a/system/Database/SQLite3/Forge.php +++ b/system/Database/SQLite3/Forge.php @@ -101,7 +101,7 @@ public function dropDatabase(string $dbName): bool } if (! empty($this->db->dataCache['db_names'])) { - $key = array_search(strtolower($dbName), array_map('strtolower', $this->db->dataCache['db_names']), true); + $key = array_search(strtolower($dbName), array_map(strtolower(...), $this->db->dataCache['db_names']), true); if ($key !== false) { unset($this->db->dataCache['db_names'][$key]); } diff --git a/system/Images/Handlers/GDHandler.php b/system/Images/Handlers/GDHandler.php index 350dbc2306a8..062a69d89212 100644 --- a/system/Images/Handlers/GDHandler.php +++ b/system/Images/Handlers/GDHandler.php @@ -471,7 +471,7 @@ protected function textOverlay(string $text, array $options = [], bool $isShadow // shorthand hex, #f00 if (strlen($color) === 3) { - $color = implode('', array_map('str_repeat', str_split($color), [2, 2, 2])); + $color = implode('', array_map(str_repeat(...), str_split($color), [2, 2, 2])); } $color = str_split(substr($color, 0, 6), 2); diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 3198d342aa9d..322987dc791b 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -853,7 +853,7 @@ public function resource(string $name, ?array $options = null): RouteCollectionI // In order to allow customization of the route the // resources are sent to, we need to have a new name // to store the values in. - $newName = implode('\\', array_map('ucfirst', explode('/', $name))); + $newName = implode('\\', array_map(ucfirst(...), explode('/', $name))); // If a new controller is specified, then we replace the // $name value with the name of the new controller. @@ -947,7 +947,7 @@ public function presenter(string $name, ?array $options = null): RouteCollection // In order to allow customization of the route the // resources are sent to, we need to have a new name // to store the values in. - $newName = implode('\\', array_map('ucfirst', explode('/', $name))); + $newName = implode('\\', array_map(ucfirst(...), explode('/', $name))); // If a new controller is specified, then we replace the // $name value with the name of the new controller. diff --git a/system/Validation/Rules.php b/system/Validation/Rules.php index 272b2dcf61fe..04e8a0546e77 100644 --- a/system/Validation/Rules.php +++ b/system/Validation/Rules.php @@ -159,7 +159,7 @@ public function in_list($value, string $list): bool $value = (string) $value; } - $list = array_map('trim', explode(',', $list)); + $list = array_map(trim(...), explode(',', $list)); return in_array($value, $list, true); }