| 1 | <?php |
||
| 17 | class RouteResolverMiddleware implements ServerMiddlewareInterface |
||
| 18 | { |
||
| 19 | |||
| 20 | /** |
||
| 21 | * The session manager. |
||
| 22 | * |
||
| 23 | * @var Router |
||
| 24 | */ |
||
| 25 | protected $router; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Create a new session middleware. |
||
| 29 | * |
||
| 30 | * @param Router $router |
||
| 31 | */ |
||
| 32 | 1 | public function __construct(Router $router) |
|
| 36 | |||
| 37 | /** |
||
| 38 | * @inheritdoc |
||
| 39 | * @param Request $request |
||
| 40 | */ |
||
| 41 | 1 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
| 51 | |||
| 52 | /** |
||
| 53 | * @param Request $request |
||
| 54 | * @param $params |
||
| 55 | */ |
||
| 56 | protected function populateRequest($request, $params) |
||
| 57 | { |
||
| 58 | foreach ($params as $param => $value) { |
||
| 59 | switch ($param) { |
||
| 60 | case 'module': |
||
| 61 | $request->setModuleName($value); |
||
| 62 | break; |
||
| 63 | case 'controller': |
||
| 64 | $request->setControllerName($value); |
||
| 65 | break; |
||
| 66 | case 'action': |
||
| 67 | $request->setActionName($value); |
||
| 68 | break; |
||
| 69 | default: |
||
| 70 | $request->attributes->set($param, $value); |
||
| 71 | break; |
||
| 72 | } |
||
| 73 | } |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @return Router |
||
| 78 | */ |
||
| 79 | 1 | public function getRouter(): Router |
|
| 83 | } |
||
| 84 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: