Skip to content

Commit

Permalink
Cleaning up
Browse files Browse the repository at this point in the history
  • Loading branch information
freost committed Nov 11, 2024
1 parent b42d6da commit e567cbc
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/mako/application/cli/commands/app/ListRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function execute(Routes $routes, Dispatcher $dispatcher, Router $router,
$labelAndValues['Pattern'] = $this->output->getFormatter()->escape($route->getRegex());
}

$maxLabelLength = max(array_map('mb_strwidth', array_keys($labelAndValues)));
$maxLabelLength = max(array_map(mb_strwidth(...), array_keys($labelAndValues)));

foreach ($labelAndValues as $label => $value) {
$label = str_pad($label, $maxLabelLength, ' ');
Expand Down
2 changes: 1 addition & 1 deletion src/mako/cli/input/helpers/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function ask(string $question, array $options): int
}
}
else {
$key = array_search(mb_strtolower($input), array_map(fn ($value) => mb_strtolower($value), $options));
$key = array_search(mb_strtolower($input), array_map(mb_strtolower(...), $options));

if ($key !== false) {
return $key;
Expand Down
2 changes: 1 addition & 1 deletion src/mako/cli/output/components/traits/HelperTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ protected function wordWrap(string $string, int $width): string
$lines[] = $line;
}

return implode(PHP_EOL, array_map('trim', $lines));
return implode(PHP_EOL, array_map(trim(...), $lines));
}
}
2 changes: 1 addition & 1 deletion src/mako/database/midgard/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public function including(array|false|string $includes): static
$currentIncludes = $this->model->getIncludes();

if (!empty($currentIncludes)) {
$withCriterion = array_filter(array_keys($includes), 'is_string');
$withCriterion = array_filter(array_keys($includes), is_string(...));

if (!empty($withCriterion)) {
foreach ($currentIncludes as $key => $value) {
Expand Down
2 changes: 1 addition & 1 deletion src/mako/http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ public function getIp(): string
$ips = $this->server->get('HTTP_X_FORWARDED_FOR');

if (!empty($ips)) {
$ips = array_reverse(array_map('trim', explode(',', $ips)));
$ips = array_reverse(array_map(trim(...), explode(',', $ips)));

foreach ($ips as $key => $value) {
if ($this->isTrustedProxy($value) === false) {
Expand Down
2 changes: 1 addition & 1 deletion src/mako/http/response/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function hasValue(string $name, string $value, bool $caseSensitive = true
return in_array($value, $this->headers[$this->normalizeName($name)]['value']);
}

return in_array(strtolower($value), array_map('strtolower', $this->headers[$this->normalizeName($name)]['value']));
return in_array(strtolower($value), array_map(strtolower(...), $this->headers[$this->normalizeName($name)]['value']));
}

return false;
Expand Down
2 changes: 1 addition & 1 deletion src/mako/pixl/processors/GD.php
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ public function sharpen(): void
{
$sharpen = [[-1.2, -1, -1.2], [-1, 20, -1], [-1.2, -1, -1.2]];

$divisor = array_sum(array_map('array_sum', $sharpen));
$divisor = array_sum(array_map(array_sum(...), $sharpen));

imageconvolution($this->image, $sharpen, $divisor, 0);
}
Expand Down
4 changes: 2 additions & 2 deletions src/mako/utility/Arr.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public static function random(array $array): mixed
*/
public static function isAssoc(array $array): bool
{
return count(array_filter(array_keys($array), 'is_string')) === count($array);
return count(array_filter(array_keys($array), is_string(...))) === count($array);
}

/**
Expand Down Expand Up @@ -174,7 +174,7 @@ public static function expandKey(array $array, string $key): array
$expanded = [];

foreach ($keys as $key) {
[$first, $remaining] = array_map('trim', explode('*', $key, 2), ['.', '.']);
[$first, $remaining] = array_map(trim(...), explode('*', $key, 2), ['.', '.']);

if (empty($first)) {
$value = $array;
Expand Down

0 comments on commit e567cbc

Please sign in to comment.