Skip to content

Commit 63acb32

Browse files
committed
Add more phpdoc
1 parent f140091 commit 63acb32

3 files changed

+34
-2
lines changed

src/MiddlewareDispatcher.php

+13
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ public function dispatch(ServerRequestInterface $request, RequestHandlerInterfac
3939
return $this->stack->handle($request);
4040
}
4141

42+
/**
43+
* Returns new instance with middleware handlers replaced.
44+
* Last specified handler will be executed first.
45+
*
46+
* @param array $middlewareDefinitions Each array element is a name of PSR-15 middleware, a callable with
47+
* `function(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface` signature or
48+
* a handler action (an array of [handlerClass, handlerMethod]). For handler action and callable typed parameters
49+
* are automatically injected using dependency injection container passed to the route.
50+
* Current request and handler could be obtained by type-hinting for {@see ServerRequestInterface}
51+
* and {@see RequestHandlerInterface}.
52+
*
53+
* @return self
54+
*/
4255
public function withMiddlewares(array $middlewareDefinitions): self
4356
{
4457
$clone = clone $this;

src/MiddlewareFactory.php

+12-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ public function create($middlewareDefinition): MiddlewareInterface
2727
}
2828

2929
/**
30-
* @param array|callable|string $middlewareDefinition
30+
* @param array|callable|string $middlewareDefinition A name of PSR-15 middleware, a callable with
31+
* `function(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface` signature or
32+
* a handler action (an array of [handlerClass, handlerMethod]). For handler action and callable typed parameters
33+
* are automatically injected using dependency injection container passed to the route.
34+
* Current request and handler could be obtained by type-hinting for {@see ServerRequestInterface}
35+
* and {@see RequestHandlerInterface}.
3136
*
3237
* @return MiddlewareInterface
3338
*/
@@ -85,7 +90,12 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
8590
}
8691

8792
/**
88-
* @param array|callable|string $middlewareDefinition
93+
* @param array|callable|string $middlewareDefinition A name of PSR-15 middleware, a callable with
94+
* `function(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface` signature or
95+
* a handler action (an array of [handlerClass, handlerMethod]). For handler action and callable typed parameters
96+
* are automatically injected using dependency injection container passed to the route.
97+
* Current request and handler could be obtained by type-hinting for {@see ServerRequestInterface}
98+
* and {@see RequestHandlerInterface}.
8999
*/
90100
private function validateMiddleware($middlewareDefinition): void
91101
{

src/MiddlewareFactoryInterface.php

+9
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,14 @@
88

99
interface MiddlewareFactoryInterface
1010
{
11+
/**
12+
* @param array|callable|string $middlewareDefinition A name of PSR-15 middleware, a callable with
13+
* `function(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface` signature or
14+
* a handler action (an array of [handlerClass, handlerMethod]). For handler action and callable typed parameters
15+
* are automatically injected using dependency injection container passed to the route.
16+
* Current request and handler could be obtained by type-hinting for {@see ServerRequestInterface}
17+
* and {@see RequestHandlerInterface}.
18+
* @return MiddlewareInterface
19+
*/
1120
public function create($middlewareDefinition): MiddlewareInterface;
1221
}

0 commit comments

Comments
 (0)