1 | <?php |
||
55 | $clientStub = new class implements HttpClient { |
||
56 | |||
57 | /** |
||
58 | * Send a request synchronously and return a PSR-7 [@see ResponseInterface] |
||
59 | * |
||
60 | * @param RequestInterface $request |
||
61 | * @return ResponseInterface |
||
62 | */ |
||
63 | public function send(RequestInterface $request): ResponseInterface |
||
67 | |||
68 | /** |
||
69 | * Send a request asynchronously |
||
70 | * |
||
71 | * The response callback must be called if any response is returned from the request, and the failure |
||
72 | * callback should only be executed if a request was not completed. |
||
73 | * |
||
74 | * The response callback should pass a PSR-7 [@see ResponseInterface] as the one and only argument. The |
||
75 | * failure callback should pass a [@see Throwable] as the one and only argument. |
||
76 | * |
||
77 | * @param RequestInterface $request |
||
78 | * @param callable $onResponse |
||
79 | * @param callable $onFailure |
||
80 | * @return void |
||
81 | */ |
||
82 | public function sendAsync(RequestInterface $request, callable $onResponse, callable $onFailure): void |
||
85 | |||
86 | /** |
||
87 | * Calling this method should execute any enqueued requests asynchronously |
||
88 | * |
||
89 | * @return void |
||
90 | */ |
||
91 | public function wait(): void |
||
94 | }; |
||
95 | |||
107 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.