1 | <?php |
||
17 | class RequestDeserializationMiddleware |
||
18 | { |
||
19 | |||
20 | /** |
||
21 | * Request handler for deserialization of incoming requests |
||
22 | * |
||
23 | * @var RequestHandler $requestHandler |
||
24 | */ |
||
25 | private $requestHandler; |
||
26 | |||
27 | /** |
||
28 | * Request entity class |
||
29 | * |
||
30 | * @var null|string $requestEntity |
||
31 | */ |
||
32 | private $requestEntity; |
||
33 | |||
34 | /** |
||
35 | * Argument position in controllers arguments |
||
36 | * |
||
37 | * @var int $argumentPosition |
||
38 | */ |
||
39 | private $argumentPosition = 0; |
||
40 | |||
41 | /** |
||
42 | * Determine matched controller and action from request |
||
43 | * |
||
44 | * @param Request|\Illuminate\Http\Request $request |
||
45 | * |
||
46 | * @return array |
||
47 | */ |
||
48 | private function parseMatchedRoute(Request $request) |
||
54 | |||
55 | /** |
||
56 | * @param Request|\Illuminate\Http\Request $request |
||
57 | * |
||
58 | * @return bool |
||
59 | * @throws \ReflectionException |
||
60 | */ |
||
61 | private function shouldValidate(Request $request) |
||
95 | |||
96 | /** |
||
97 | * RequestDeserializationMiddleware constructor. |
||
98 | * |
||
99 | * @param RequestHandler $requestHandler |
||
100 | */ |
||
101 | public function __construct(RequestHandler $requestHandler) |
||
105 | |||
106 | /** |
||
107 | * Handle an incoming request. |
||
108 | * |
||
109 | * @param \Illuminate\Http\Request $request |
||
110 | * @param \Closure $next |
||
111 | * |
||
112 | * @return mixed |
||
113 | * @throws \ReflectionException |
||
114 | * |
||
115 | * @throws \LogicException |
||
116 | * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException |
||
117 | * @throws \Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException |
||
118 | */ |
||
119 | public function handle($request, Closure $next) |
||
135 | |||
136 | } |
||
137 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.