1 | <?php |
||
20 | class SymfonyEventDispatcherDecorator implements HttpClientInterface |
||
21 | { |
||
22 | /** |
||
23 | * HTTP Client |
||
24 | * |
||
25 | * @var HttpClientInterface |
||
26 | */ |
||
27 | protected $client; |
||
28 | |||
29 | /** |
||
30 | * @var EventDispatcherInterface |
||
31 | */ |
||
32 | protected $dispatcher; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $requestEvent; |
||
38 | |||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $responseEvent; |
||
43 | |||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $exceptionEvent; |
||
48 | |||
49 | /** |
||
50 | * SymfonyEventDispatcherDecorator constructor. |
||
51 | * |
||
52 | * @param HttpClientInterface $client |
||
53 | * @param EventDispatcherInterface $dispatcher |
||
54 | * |
||
55 | * @param string $requestEvent |
||
56 | * @param string $responseEvent |
||
57 | * @param string $exceptionEvent |
||
58 | */ |
||
59 | 4 | public function __construct( |
|
74 | |||
75 | /** |
||
76 | * {@inheritdoc} |
||
77 | */ |
||
78 | 4 | public function request(RequestInterface $request): ResponseInterface |
|
102 | |||
103 | /** |
||
104 | * Handler exception |
||
105 | * |
||
106 | * @param \Throwable $exception |
||
107 | * @param RequestInterface $request |
||
108 | * @return RequestException |
||
109 | */ |
||
110 | 2 | protected function handleException(\Throwable $exception, RequestInterface $request): RequestException |
|
118 | |||
119 | /** |
||
120 | * Dispatch on-request event |
||
121 | * |
||
122 | * @param RequestInterface $request |
||
123 | * @return RequestInterface |
||
124 | */ |
||
125 | 4 | protected function dispatchOnRequest(RequestInterface $request): RequestInterface |
|
132 | |||
133 | /** |
||
134 | * Dispatch on-response event |
||
135 | * |
||
136 | * @param ResponseInterface $response |
||
137 | * @return ResponseInterface |
||
138 | */ |
||
139 | 2 | protected function dispatchOnResponse(ResponseInterface $response): ResponseInterface |
|
146 | } |
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.