Skip to content

Commit

Permalink
[TASK] Use first class callable syntax for array_map calls
Browse files Browse the repository at this point in the history
  • Loading branch information
eliashaeussler authored and renovate[bot] committed Jul 6, 2024
1 parent dd662c7 commit c1f37a8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Crawler/CrawlerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function parseCrawlerOptions(string|array|null $crawlerOptions): array
}

// Handle non-associative-array crawler options
if ($crawlerOptions !== array_filter($crawlerOptions, 'is_string', ARRAY_FILTER_USE_KEY)) {
if ($crawlerOptions !== array_filter($crawlerOptions, is_string(...), ARRAY_FILTER_USE_KEY)) {
throw new Exception\CrawlerOptionIsInvalid($crawlerOptions);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Formatter/JsonFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private function addToJson(string $path, string|bool|array $value): void
Helper\ArrayHelper::setValueByPath($this->json, $path, $value);
}
if (is_array($value) && [] !== $value) {
Helper\ArrayHelper::setValueByPath($this->json, $path, array_map('strval', $value));
Helper\ArrayHelper::setValueByPath($this->json, $path, array_map(strval(...), $value));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Helper/ArrayHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static function trimExplode(string $subject, string $delimiter = ','): ar
return array_values(
array_filter(
array_map(
'trim',
trim(...),
explode($delimiter, $subject),
),
static fn (string $value) => '' !== $value,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Command/CacheWarmupCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ public function executeCrawlsUrlsWithConfiguredStrategy(): void
'https://www.example.org/',
];

self::assertSame($expected, array_map('strval', Tests\Fixtures\Classes\DummyCrawler::$crawledUrls));
self::assertSame($expected, array_map(strval(...), Tests\Fixtures\Classes\DummyCrawler::$crawledUrls));
}

#[Framework\Attributes\Test]
Expand Down

0 comments on commit c1f37a8

Please sign in to comment.