mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 15:23:12 +08:00
Replaced regular callbacks by arrow functions when possible
This commit is contained in:
@@ -43,9 +43,7 @@ class RequestToHttpAuthPlugin implements RequestToHttpAuthPluginInterface
|
||||
{
|
||||
return array_reduce(
|
||||
self::SUPPORTED_AUTH_HEADERS,
|
||||
function (bool $carry, string $header) use ($request) {
|
||||
return $carry || $request->hasHeader($header);
|
||||
},
|
||||
fn (bool $carry, string $header) => $carry || $request->hasHeader($header),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@ class EmptyResponseImplicitOptionsMiddlewareFactory
|
||||
{
|
||||
public function __invoke()
|
||||
{
|
||||
return new ImplicitOptionsMiddleware(function () {
|
||||
return new EmptyResponse();
|
||||
});
|
||||
return new ImplicitOptionsMiddleware(fn () => new EmptyResponse());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,9 +91,7 @@ class CreateShortUrlActionTest extends ApiTestCase
|
||||
|
||||
public function provideMaxVisits(): array
|
||||
{
|
||||
return map(range(10, 15), function (int $i) {
|
||||
return [$i];
|
||||
});
|
||||
return map(range(10, 15), fn (int $i) => [$i]);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
|
||||
@@ -34,9 +34,7 @@ class AuthenticationPluginManagerFactoryTest extends TestCase
|
||||
|
||||
private function getPlugins(AuthenticationPluginManager $pluginManager): array
|
||||
{
|
||||
return (function () {
|
||||
return $this->services;
|
||||
})->call($pluginManager);
|
||||
return (fn () => $this->services)->call($pluginManager);
|
||||
}
|
||||
|
||||
public function provideConfigs(): iterable
|
||||
|
||||
@@ -28,15 +28,13 @@ class ConfigProviderTest extends TestCase
|
||||
/** @test */
|
||||
public function routesAreProperlyPrefixed(): void
|
||||
{
|
||||
$configProvider = new ConfigProvider(function () {
|
||||
return [
|
||||
'routes' => [
|
||||
['path' => '/foo'],
|
||||
['path' => '/bar'],
|
||||
['path' => '/baz/foo'],
|
||||
],
|
||||
];
|
||||
});
|
||||
$configProvider = new ConfigProvider(fn () => [
|
||||
'routes' => [
|
||||
['path' => '/foo'],
|
||||
['path' => '/bar'],
|
||||
['path' => '/baz/foo'],
|
||||
],
|
||||
]);
|
||||
|
||||
$config = $configProvider();
|
||||
|
||||
|
||||
@@ -109,8 +109,6 @@ class AuthenticationMiddlewareTest extends TestCase
|
||||
|
||||
private function getDummyMiddleware(): MiddlewareInterface
|
||||
{
|
||||
return middleware(function () {
|
||||
return new Response\EmptyResponse();
|
||||
});
|
||||
return middleware(fn () => new Response\EmptyResponse());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user