File tree 6 files changed +11
-10
lines changed
6 files changed +11
-10
lines changed Original file line number Diff line number Diff line change 27
27
"require-dev" : {
28
28
"nyholm/psr7" : " ^1.4" ,
29
29
"phpunit/phpunit" : " ^9.5" ,
30
- "roave/infection-static-analysis-plugin" : " ^1.8 " ,
30
+ "roave/infection-static-analysis-plugin" : " ^1.13 " ,
31
31
"spatie/phpunit-watcher" : " ^1.23" ,
32
- "vimeo/psalm" : " ^4.9 " ,
32
+ "vimeo/psalm" : " ^4.18 " ,
33
33
"yiisoft/test-support" : " ^1.3"
34
34
},
35
35
"autoload" : {
Original file line number Diff line number Diff line change 8
8
use Psr \Http \Server \MiddlewareInterface ;
9
9
10
10
/**
11
- * AfterMiddleware event is raised after a middleware was executed.
11
+ * ` AfterMiddleware` event is raised after a middleware was executed.
12
12
*/
13
13
final class AfterMiddleware
14
14
{
Original file line number Diff line number Diff line change 8
8
use Psr \Http \Server \MiddlewareInterface ;
9
9
10
10
/**
11
- * AfterMiddleware event is raised before executing a middleware.
11
+ * `BeforeMiddleware` event is raised before executing a middleware.
12
12
*/
13
13
final class BeforeMiddleware
14
14
{
Original file line number Diff line number Diff line change 4
4
5
5
namespace Yiisoft \Middleware \Dispatcher ;
6
6
7
+ use Closure ;
7
8
use Psr \EventDispatcher \EventDispatcherInterface ;
8
9
use Psr \Http \Message \ResponseInterface ;
9
10
use Psr \Http \Message \ServerRequestInterface ;
@@ -15,7 +16,7 @@ final class MiddlewareDispatcher
15
16
/**
16
17
* Contains a middleware pipeline handler.
17
18
*
18
- * @var MiddlewareStack The middleware stack.
19
+ * @var MiddlewareStack|null The middleware stack.
19
20
*/
20
21
private ?MiddlewareStack $ stack = null ;
21
22
private MiddlewareFactoryInterface $ middlewareFactory ;
@@ -90,7 +91,7 @@ public function hasMiddlewares(): bool
90
91
}
91
92
92
93
/**
93
- * @return \ Closure[]
94
+ * @return Closure[]
94
95
*/
95
96
private function buildMiddlewares (): array
96
97
{
Original file line number Diff line number Diff line change @@ -96,8 +96,6 @@ public function process(
96
96
};
97
97
}
98
98
99
- /** @var callable $callback */
100
-
101
99
return new class ($ callback , $ this ->container ) implements MiddlewareInterface {
102
100
private ContainerInterface $ container ;
103
101
private $ callback ;
Original file line number Diff line number Diff line change @@ -50,15 +50,17 @@ public function handle(ServerRequestInterface $request): ResponseInterface
50
50
$ this ->build ();
51
51
}
52
52
53
- /** @psalm-suppress PossiblyNullReference */
54
53
return $ this ->stack ->handle ($ request );
55
54
}
56
55
56
+ /**
57
+ * @psalm-assert RequestHandlerInterface $this->stack
58
+ */
57
59
private function build (): void
58
60
{
59
61
$ handler = $ this ->fallbackHandler ;
60
62
61
- /** @var Closure $middleware */
63
+ /** @var Closure $middleware */
62
64
foreach ($ this ->middlewares as $ middleware ) {
63
65
$ handler = $ this ->wrap ($ middleware , $ handler );
64
66
}
You can’t perform that action at this time.
0 commit comments