Skip to content

Commit 5762bfe

Browse files
authored
Cleanup (#26)
1 parent 74c089c commit 5762bfe

6 files changed

+23
-15
lines changed

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ trim_trailing_whitespace = true
1212

1313
[*.md]
1414
trim_trailing_whitespace = false
15+
16+
[*.yml]
17+
indent_size = 2

psalm.xml

-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,5 @@
77
>
88
<projectFiles>
99
<directory name="src" />
10-
<ignoreFiles>
11-
<directory name="vendor" />
12-
</ignoreFiles>
1310
</projectFiles>
1411
</psalm>

src/MiddlewareDispatcher.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ public function __construct(MiddlewareFactoryInterface $middlewareFactory, Middl
3737
* @param ServerRequestInterface $request Request to pass to middleware.
3838
* @param RequestHandlerInterface $fallbackHandler Handler to use in case no middleware produced response.
3939
*/
40-
public function dispatch(ServerRequestInterface $request, RequestHandlerInterface $fallbackHandler): ResponseInterface
41-
{
40+
public function dispatch(
41+
ServerRequestInterface $request,
42+
RequestHandlerInterface $fallbackHandler
43+
): ResponseInterface {
4244
if ($this->pipeline->isEmpty()) {
4345
$this->pipeline = $this->pipeline->build($this->buildMiddlewares(), $fallbackHandler);
4446
}

src/MiddlewareFactory.php

+11-6
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,21 @@ private function wrapCallable($callback): MiddlewareInterface
7272

7373
public function __construct(ContainerInterface $container, array $callback)
7474
{
75-
[$this->class , $this->method] = $callback;
75+
[$this->class, $this->method] = $callback;
7676
$this->container = $container;
7777
$this->callback = $callback;
7878
}
7979

80-
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
81-
{
80+
public function process(
81+
ServerRequestInterface $request,
82+
RequestHandlerInterface $handler
83+
): ResponseInterface {
8284
/** @var mixed $controller */
8385
$controller = $this->container->get($this->class);
8486

8587
/** @var mixed $response */
86-
$response = (new Injector($this->container))->invoke([$controller, $this->method], [$request, $handler]);
88+
$response = (new Injector($this->container))
89+
->invoke([$controller, $this->method], [$request, $handler]);
8790
if ($response instanceof ResponseInterface) {
8891
return $response;
8992
}
@@ -105,8 +108,10 @@ public function __construct(callable $callback, ContainerInterface $container)
105108
$this->container = $container;
106109
}
107110

108-
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
109-
{
111+
public function process(
112+
ServerRequestInterface $request,
113+
RequestHandlerInterface $handler
114+
): ResponseInterface {
110115
/** @var mixed $response */
111116
$response = (new Injector($this->container))->invoke($this->callback, [$request, $handler]);
112117
if ($response instanceof ResponseInterface) {

src/MiddlewarePipelineInterface.php

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ interface MiddlewarePipelineInterface extends RequestHandlerInterface
2020
*
2121
* @param MiddlewareInterface[] $middlewares Middlewares being composed to pipeline. Can be empty.
2222
* @param RequestHandlerInterface $fallbackHandler Fallback request handler.
23-
*
24-
* @return self
2523
*/
2624
public function build(array $middlewares, RequestHandlerInterface $fallbackHandler): self;
2725

src/MiddlewareStack.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,11 @@ private function wrap(MiddlewareInterface $middleware, RequestHandlerInterface $
8383
private RequestHandlerInterface $handler;
8484
private EventDispatcherInterface $eventDispatcher;
8585

86-
public function __construct(MiddlewareInterface $middleware, RequestHandlerInterface $handler, EventDispatcherInterface $eventDispatcher)
87-
{
86+
public function __construct(
87+
MiddlewareInterface $middleware,
88+
RequestHandlerInterface $handler,
89+
EventDispatcherInterface $eventDispatcher
90+
) {
8891
$this->middleware = $middleware;
8992
$this->handler = $handler;
9093
$this->eventDispatcher = $eventDispatcher;

0 commit comments

Comments
 (0)