19
19
use Symfony \Component \HttpClient \Response \MockResponse ;
20
20
use Symfony \Component \HttpClient \Response \StreamableInterface ;
21
21
use Symfony \Component \HttpClient \Response \StreamWrapper ;
22
- use Symfony \Contracts \HttpClient \Exception \ClientExceptionInterface ;
23
- use Symfony \Contracts \HttpClient \Exception \DecodingExceptionInterface ;
24
- use Symfony \Contracts \HttpClient \Exception \RedirectionExceptionInterface ;
25
- use Symfony \Contracts \HttpClient \Exception \ServerExceptionInterface ;
26
- use Symfony \Contracts \HttpClient \Exception \TransportExceptionInterface ;
27
22
use Symfony \Contracts \HttpClient \ResponseInterface ;
28
23
use Throwable ;
29
24
@@ -74,23 +69,11 @@ public function judgeFailureUsing(callable $callback): static
74
69
return $ this ;
75
70
}
76
71
77
- /**
78
- * @throws TransportExceptionInterface
79
- * @throws ServerExceptionInterface
80
- * @throws RedirectionExceptionInterface
81
- * @throws ClientExceptionInterface
82
- */
83
72
public function isSuccessful (): bool
84
73
{
85
74
return ! $ this ->isFailed ();
86
75
}
87
76
88
- /**
89
- * @throws TransportExceptionInterface
90
- * @throws ServerExceptionInterface
91
- * @throws RedirectionExceptionInterface
92
- * @throws ClientExceptionInterface
93
- */
94
77
public function isFailed (): bool
95
78
{
96
79
if ($ this ->is ('text ' ) && $ this ->failureJudge ) {
@@ -105,11 +88,6 @@ public function isFailed(): bool
105
88
}
106
89
107
90
/**
108
- * @throws TransportExceptionInterface
109
- * @throws ServerExceptionInterface
110
- * @throws RedirectionExceptionInterface
111
- * @throws DecodingExceptionInterface
112
- * @throws ClientExceptionInterface
113
91
* @throws BadResponseException
114
92
*/
115
93
public function toArray (?bool $ throw = null ): array
@@ -135,21 +113,15 @@ public function toArray(?bool $throw = null): array
135
113
return $ this ->response ->toArray ($ throw );
136
114
}
137
115
138
- /**
139
- * @throws TransportExceptionInterface
140
- * @throws ServerExceptionInterface
141
- * @throws RedirectionExceptionInterface
142
- * @throws DecodingExceptionInterface
143
- * @throws ClientExceptionInterface
144
- * @throws BadResponseException
145
- */
146
116
public function toJson (?bool $ throw = null ): string |false
147
117
{
148
118
return json_encode ($ this ->toArray ($ throw ), JSON_UNESCAPED_UNICODE );
149
119
}
150
120
151
121
/**
152
122
* {@inheritdoc}
123
+ *
124
+ * @throws BadMethodCallException
153
125
*/
154
126
public function toStream (?bool $ throw = null )
155
127
{
@@ -165,10 +137,7 @@ public function toStream(?bool $throw = null)
165
137
}
166
138
167
139
/**
168
- * @throws TransportExceptionInterface
169
- * @throws ServerExceptionInterface
170
- * @throws RedirectionExceptionInterface
171
- * @throws ClientExceptionInterface
140
+ * @throws \LogicException
172
141
*/
173
142
public function toDataUrl (): string
174
143
{
@@ -214,10 +183,6 @@ public function toPsrResponse(?ResponseFactoryInterface $responseFactory = null,
214
183
}
215
184
216
185
/**
217
- * @throws ClientExceptionInterface
218
- * @throws RedirectionExceptionInterface
219
- * @throws ServerExceptionInterface
220
- * @throws TransportExceptionInterface
221
186
* @throws BadResponseException
222
187
*/
223
188
public function saveAs (string $ filename ): string
@@ -235,27 +200,11 @@ public function saveAs(string $filename): string
235
200
return '' ;
236
201
}
237
202
238
- /**
239
- * @throws TransportExceptionInterface
240
- * @throws ServerExceptionInterface
241
- * @throws RedirectionExceptionInterface
242
- * @throws DecodingExceptionInterface
243
- * @throws ClientExceptionInterface
244
- * @throws BadResponseException
245
- */
246
203
public function offsetExists (mixed $ offset ): bool
247
204
{
248
205
return array_key_exists ($ offset , $ this ->toArray ());
249
206
}
250
207
251
- /**
252
- * @throws TransportExceptionInterface
253
- * @throws ServerExceptionInterface
254
- * @throws RedirectionExceptionInterface
255
- * @throws DecodingExceptionInterface
256
- * @throws ClientExceptionInterface
257
- * @throws BadResponseException
258
- */
259
208
public function offsetGet (mixed $ offset ): mixed
260
209
{
261
210
return $ this ->toArray ()[$ offset ] ?? null ;
@@ -310,37 +259,18 @@ public function getInfo(?string $type = null): mixed
310
259
return $ this ->response ->getInfo ($ type );
311
260
}
312
261
313
- /**
314
- * @throws TransportExceptionInterface
315
- * @throws ServerExceptionInterface
316
- * @throws RedirectionExceptionInterface
317
- * @throws DecodingExceptionInterface
318
- * @throws ClientExceptionInterface
319
- * @throws BadResponseException
320
- */
321
262
public function __toString (): string
322
263
{
323
264
return $ this ->toJson () ?: '' ;
324
265
}
325
266
326
- /**
327
- * @throws TransportExceptionInterface
328
- * @throws ServerExceptionInterface
329
- * @throws RedirectionExceptionInterface
330
- * @throws ClientExceptionInterface
331
- */
332
267
public function hasHeader (string $ name , ?bool $ throw = null ): bool
333
268
{
334
269
return isset ($ this ->getHeaders ($ throw )[$ name ]);
335
270
}
336
271
337
272
/**
338
273
* @return array<array-key, mixed>
339
- *
340
- * @throws TransportExceptionInterface
341
- * @throws ServerExceptionInterface
342
- * @throws RedirectionExceptionInterface
343
- * @throws ClientExceptionInterface
344
274
*/
345
275
public function getHeader (string $ name , ?bool $ throw = null ): array
346
276
{
@@ -350,12 +280,6 @@ public function getHeader(string $name, ?bool $throw = null): array
350
280
return $ this ->hasHeader ($ name , $ throw ) ? $ this ->getHeaders ($ throw )[$ name ] : [];
351
281
}
352
282
353
- /**
354
- * @throws TransportExceptionInterface
355
- * @throws ServerExceptionInterface
356
- * @throws RedirectionExceptionInterface
357
- * @throws ClientExceptionInterface
358
- */
359
283
public function getHeaderLine (string $ name , ?bool $ throw = null ): string
360
284
{
361
285
$ name = strtolower ($ name );
@@ -364,12 +288,6 @@ public function getHeaderLine(string $name, ?bool $throw = null): string
364
288
return $ this ->hasHeader ($ name , $ throw ) ? implode (', ' , $ this ->getHeader ($ name , $ throw )) : '' ;
365
289
}
366
290
367
- /**
368
- * @throws TransportExceptionInterface
369
- * @throws ServerExceptionInterface
370
- * @throws RedirectionExceptionInterface
371
- * @throws ClientExceptionInterface
372
- */
373
291
public function is (string $ type ): bool
374
292
{
375
293
$ contentType = $ this ->getHeaderLine ('content-type ' );
0 commit comments