@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Acelaya\ExpressiveErrorHandler\ErrorHandler\Factory; |
5 | 5 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __invoke(ContainerInterface $container) |
25 | 25 | { |
26 | - $config = $container->has('config') ? $container->get('config') : []; |
|
27 | - return new ErrorResponseGenerator(isset($config['debug']) ? (bool) $config['debug'] : false); |
|
26 | + $config = $container->has('config') ? $container->get('config') : [ ]; |
|
27 | + return new ErrorResponseGenerator(isset($config[ 'debug' ]) ? (bool) $config[ 'debug' ] : false); |
|
28 | 28 | } |
29 | 29 | } |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Acelaya\ExpressiveErrorHandler\Log; |
5 | 5 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Acelaya\ExpressiveErrorHandler\Exception; |
5 | 5 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Acelaya\ExpressiveErrorHandler; |
5 | 5 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace Acelaya\ExpressiveErrorHandler\ErrorHandler; |
5 | 5 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace AcelayaTest\ExpressiveErrorHandler; |
5 | 5 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace AcelayaTest\ExpressiveErrorHandler\ErrorHandler; |
5 | 5 | |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | $this->errorHandler = new ContentBasedErrorResponseGenerator( |
25 | 25 | new ErrorResponseGeneratorManager(new ServiceManager(), [ |
26 | 26 | 'factories' => [ |
27 | - 'text/html' => [$this, 'factory'], |
|
28 | - 'application/json' => [$this, 'factory'], |
|
27 | + 'text/html' => [ $this, 'factory' ], |
|
28 | + 'application/json' => [ $this, 'factory' ], |
|
29 | 29 | ], |
30 | 30 | ]), |
31 | 31 | new NullLogger(), |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | public function factory($container, $name) |
37 | 37 | { |
38 | - return function () use ($name) { |
|
38 | + return function() use ($name) { |
|
39 | 39 | return (new Response())->withHeader('Content-type', $name); |
40 | 40 | }; |
41 | 41 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | public function ifNoErrorHandlerIsFoundAnExceptionIsThrown() |
78 | 78 | { |
79 | 79 | $this->errorHandler = new ContentBasedErrorResponseGenerator( |
80 | - new ErrorResponseGeneratorManager(new ServiceManager(), []), |
|
80 | + new ErrorResponseGeneratorManager(new ServiceManager(), [ ]), |
|
81 | 81 | new NullLogger(), |
82 | 82 | new BasicLogMessageBuilder() |
83 | 83 | ); |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | $this->errorHandler = new ContentBasedErrorResponseGenerator( |
94 | 94 | new ErrorResponseGeneratorManager(new ServiceManager(), [ |
95 | 95 | 'factories' => [ |
96 | - 'text/html' => [$this, 'factory'], |
|
97 | - 'application/json' => [$this, 'factory'], |
|
96 | + 'text/html' => [ $this, 'factory' ], |
|
97 | + 'application/json' => [ $this, 'factory' ], |
|
98 | 98 | ], |
99 | 99 | ]), |
100 | 100 | new NullLogger(), |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace AcelayaTest\ExpressiveErrorHandler\ErrorHandler; |
5 | 5 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | { |
19 | 19 | $this->pluginManager = new ErrorResponseGeneratorManager(new ServiceManager(), [ |
20 | 20 | 'services' => [ |
21 | - 'foo' => function () { |
|
21 | + 'foo' => function() { |
|
22 | 22 | }, |
23 | 23 | ], |
24 | 24 | 'invokables' => [ |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace AcelayaTest\ExpressiveErrorHandler\ErrorHandler\Factory; |
5 | 5 | |
@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function serviceIsCreated() |
30 | 30 | { |
31 | - $instance = $this->factory->__invoke(new ServiceManager(['services' => [ |
|
31 | + $instance = $this->factory->__invoke(new ServiceManager([ 'services' => [ |
|
32 | 32 | ErrorResponseGeneratorManager::class => $this->prophesize(ErrorResponseGeneratorManager::class)->reveal(), |
33 | 33 | LogMessageBuilderInterface::class => $this->prophesize(LogMessageBuilderInterface::class)->reveal(), |
34 | - ]])); |
|
34 | + ] ])); |
|
35 | 35 | $this->assertInstanceOf(ContentBasedErrorResponseGenerator::class, $instance); |
36 | 36 | |
37 | - $instance = $this->factory->__invoke(new ServiceManager(['services' => [ |
|
37 | + $instance = $this->factory->__invoke(new ServiceManager([ 'services' => [ |
|
38 | 38 | ErrorResponseGeneratorManager::class => $this->prophesize(ErrorResponseGeneratorManager::class)->reveal(), |
39 | 39 | LogMessageBuilderInterface::class => $this->prophesize(LogMessageBuilderInterface::class)->reveal(), |
40 | 40 | LoggerInterface::class => $this->prophesize(LoggerInterface::class)->reveal(), |
41 | - ]])); |
|
41 | + ] ])); |
|
42 | 42 | $this->assertInstanceOf(ContentBasedErrorResponseGenerator::class, $instance); |
43 | 43 | } |
44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | public function defaultContentTypeIsSetWhenDefined() |
49 | 49 | { |
50 | 50 | /** @var ContentBasedErrorResponseGenerator $instance */ |
51 | - $instance = $this->factory->__invoke(new ServiceManager(['services' => [ |
|
51 | + $instance = $this->factory->__invoke(new ServiceManager([ 'services' => [ |
|
52 | 52 | ErrorResponseGeneratorManager::class => $this->prophesize(ErrorResponseGeneratorManager::class)->reveal(), |
53 | 53 | LogMessageBuilderInterface::class => $this->prophesize(LogMessageBuilderInterface::class)->reveal(), |
54 | 54 | 'config' => [ |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | 'default_content_type' => 'application/json', |
57 | 57 | ], |
58 | 58 | ], |
59 | - ]])); |
|
59 | + ] ])); |
|
60 | 60 | |
61 | 61 | $ref = new \ReflectionObject($instance); |
62 | 62 | $prop = $ref->getProperty('defaultContentType'); |