Skip to content
This repository was archived by the owner on Jul 6, 2024. It is now read-only.

Commit 4e42d08

Browse files
author
Dominik Zogg
committed
cs fix
1 parent c8c0ede commit 4e42d08

File tree

6 files changed

+12
-20
lines changed

6 files changed

+12
-20
lines changed

src/ServiceFactory/ApiHttpServiceFactory.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ final class ApiHttpServiceFactory
1616
public function __invoke(): array
1717
{
1818
return [
19-
'api-http.request.manager' => static function (ContainerInterface $container) {
20-
return new RequestManager($container->get('deserializer'));
21-
},
19+
'api-http.request.manager' => static fn (ContainerInterface $container) => new RequestManager($container->get('deserializer')),
2220
'api-http.response.manager' => static function (ContainerInterface $container) {
2321
return new ResponseManager(
2422
$container->get('api-http.response.factory'),

src/ServiceProvider/ApiHttpServiceProvider.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ final class ApiHttpServiceProvider implements ServiceProviderInterface
1313
{
1414
public function register(Container $container): void
1515
{
16-
$container['api-http.request.manager'] = static function () use ($container) {
17-
return new RequestManager($container['deserializer']);
18-
};
16+
$container['api-http.request.manager'] = static fn () => new RequestManager($container['deserializer']);
1917

2018
$container['api-http.response.manager'] = static function () use ($container) {
2119
return new ResponseManager(

tests/Unit/Middleware/AcceptAndContentTypeMiddlewareTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
5959
$responseManager = $this->getMockByCalls(ResponseManagerInterface::class, [
6060
Call::create('createFromApiProblem')
6161
->with(
62-
new ArgumentCallback(function (NotAcceptable $apiProblem): void {
62+
new ArgumentCallback(static function (NotAcceptable $apiProblem): void {
6363
self::assertSame('application/xml', $apiProblem->getAccept());
6464
self::assertSame(['application/json'], $apiProblem->getAcceptables());
6565
}),
@@ -163,7 +163,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
163163
$responseManager = $this->getMockByCalls(ResponseManagerInterface::class, [
164164
Call::create('createFromApiProblem')
165165
->with(
166-
new ArgumentCallback(function (UnsupportedMediaType $apiProblem): void {
166+
new ArgumentCallback(static function (UnsupportedMediaType $apiProblem): void {
167167
self::assertSame('application/xml', $apiProblem->getMediaType());
168168
self::assertSame(['application/json'], $apiProblem->getSupportedMediaTypes());
169169
}),

tests/Unit/Middleware/ApiExceptionMiddlewareTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
9191
Call::create('error')
9292
->with(
9393
'Exception',
94-
new ArgumentCallback(function (array $context): void {
94+
new ArgumentCallback(static function (array $context): void {
9595
$backtrace = $context['backtrace'];
9696

9797
self::assertCount(2, $backtrace);
@@ -143,7 +143,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
143143
$responseManager = $this->getMockByCalls(ResponseManagerInterface::class, [
144144
Call::create('createFromApiProblem')
145145
->with(
146-
new ArgumentCallback(function (InternalServerError $error): void {
146+
new ArgumentCallback(static function (InternalServerError $error): void {
147147
self::assertSame('runtime exception', $error->getDetail());
148148

149149
$backtrace = $error->getBacktrace();
@@ -179,7 +179,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
179179
Call::create('error')
180180
->with(
181181
'Exception',
182-
new ArgumentCallback(function (array $context): void {
182+
new ArgumentCallback(static function (array $context): void {
183183
$backtrace = $context['backtrace'];
184184

185185
self::assertCount(2, $backtrace);
@@ -231,7 +231,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
231231
$responseManager = $this->getMockByCalls(ResponseManagerInterface::class, [
232232
Call::create('createFromApiProblem')
233233
->with(
234-
new ArgumentCallback(function (InternalServerError $error): void {
234+
new ArgumentCallback(static function (InternalServerError $error): void {
235235
self::assertNull($error->getDetail());
236236
self::assertNull($error->getBacktrace());
237237
}),
@@ -246,7 +246,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
246246
Call::create('error')
247247
->with(
248248
'Exception',
249-
new ArgumentCallback(function (array $context): void {
249+
new ArgumentCallback(static function (array $context): void {
250250
$backtrace = $context['backtrace'];
251251

252252
self::assertCount(2, $backtrace);
@@ -298,7 +298,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
298298
$responseManager = $this->getMockByCalls(ResponseManagerInterface::class, [
299299
Call::create('createFromApiProblem')
300300
->with(
301-
new ArgumentCallback(function (InternalServerError $error): void {
301+
new ArgumentCallback(static function (InternalServerError $error): void {
302302
self::assertNull($error->getDetail());
303303
self::assertNull($error->getBacktrace());
304304
}),

tests/Unit/ServiceFactory/ApiHttpServiceFactoryTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ public function testRegister(): void
3434
$container->factories((new DeserializationServiceFactory())());
3535
$container->factories((new SerializationServiceFactory())());
3636

37-
$container->factory('api-http.response.factory', static function () use ($responseFactory) {
38-
return $responseFactory;
39-
});
37+
$container->factory('api-http.response.factory', static fn () => $responseFactory);
4038

4139
self::assertTrue($container->has('api-http.response.manager'));
4240
self::assertTrue($container->has('api-http.response.factory'));

tests/Unit/ServiceProvider/ApiHttpServiceProviderTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ public function testRegister(): void
3333
$container->register(new DeserializationServiceProvider());
3434
$container->register(new SerializationServiceProvider());
3535

36-
$container['api-http.response.factory'] = function () use ($responseFactory) {
37-
return $responseFactory;
38-
};
36+
$container['api-http.response.factory'] = static fn () => $responseFactory;
3937

4038
self::assertTrue(isset($container['api-http.response.manager']));
4139
self::assertTrue(isset($container['api-http.response.factory']));

0 commit comments

Comments
 (0)