1 | <?php |
||
21 | class FastRouteMiddleware implements MiddlewareInterface |
||
22 | { |
||
23 | /** |
||
24 | * Fast Route Dispatcher |
||
25 | * |
||
26 | * @var \FastRoute\Dispatcher |
||
27 | */ |
||
28 | protected $dispatcher; |
||
29 | |||
30 | /** |
||
31 | * Route not allowed Handler |
||
32 | * |
||
33 | * @var null|\Burzum\FastRouteMiddleware\Handler\NotAllowedHandlerInterface |
||
34 | */ |
||
35 | protected $notAllowedHandler; |
||
36 | |||
37 | /** |
||
38 | * Route not found Handler |
||
39 | * |
||
40 | * @var null|\Burzum\FastRouteMiddleware\Handler\NotFoundHandlerInterface |
||
41 | */ |
||
42 | protected $notFoundHandler; |
||
43 | |||
44 | /** |
||
45 | * Route Found Handler |
||
46 | * |
||
47 | * @var null|\Burzum\FastRouteMiddleware\Handler\FoundHandlerInterface |
||
48 | */ |
||
49 | protected $foundHandler; |
||
50 | |||
51 | /** |
||
52 | * Constructor |
||
53 | * |
||
54 | * @param \FastRoute\Dispatcher $dispatcher Fastroute Dispatcher |
||
55 | * @param null|\Burzum\FastRouteMiddleware\Handler\FoundHandlerInterface $foundHandler Found Handler |
||
56 | * @param null|\Burzum\FastRouteMiddleware\Handler\NotFoundHandlerInterface $notAllowedHandler Not Found Handler |
||
57 | * @param null|\Burzum\FastRouteMiddleware\Handler\NotAllowedHandlerInterface $notAllowedHandler Not Allowed Handler |
||
58 | */ |
||
59 | 1 | public function __construct( |
|
70 | |||
71 | /** |
||
72 | * Process an incoming server request and return a response, optionally |
||
73 | * delegating response creation to a handler. |
||
74 | * |
||
75 | * @param \Psr\Http\Message\ServerRequestInterface $request Request |
||
76 | * @param \Psr\Http\Server\RequestHandlerInterface $requestHandler Request Handler |
||
77 | * @return \Psr\Http\Message\ResponseInterface |
||
78 | */ |
||
79 | 1 | public function process( |
|
113 | |||
114 | /** |
||
115 | * Dispatches the Request URI |
||
116 | * |
||
117 | * @return array |
||
118 | */ |
||
119 | 1 | protected function dispatch(): array |
|
133 | } |
||
134 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.