@@ -244,12 +244,12 @@ public function supportsDeserialization($format)
244
244
public function supportsEncoding ($ format )
245
245
{
246
246
try {
247
- $ encoder = $ this ->getEncoder ($ format );
247
+ $ this ->getEncoder ($ format );
248
248
} catch (\RuntimeException $ e ) {
249
249
return false ;
250
250
}
251
251
252
- return $ encoder instanceof EncoderInterface ;
252
+ return true ;
253
253
}
254
254
255
255
/**
@@ -258,12 +258,12 @@ public function supportsEncoding($format)
258
258
public function supportsDecoding ($ format )
259
259
{
260
260
try {
261
- $ encoder = $ this ->getEncoder ($ format );
261
+ $ this ->getDecoder ($ format );
262
262
} catch (\RuntimeException $ e ) {
263
263
return false ;
264
264
}
265
265
266
- return $ encoder instanceof DecoderInterface ;
266
+ return true ;
267
267
}
268
268
269
269
/**
@@ -278,7 +278,9 @@ private function getEncoder($format)
278
278
}
279
279
280
280
foreach ($ this ->encoders as $ i => $ encoder ) {
281
- if ($ encoder ->supportsEncoding ($ format )) {
281
+ if ($ encoder instanceof EncoderInterface
282
+ && $ encoder ->supportsEncoding ($ format )
283
+ ) {
282
284
$ this ->encoderByFormat [$ format ] = $ i ;
283
285
return $ encoder ;
284
286
}
@@ -299,7 +301,9 @@ private function getDecoder($format)
299
301
}
300
302
301
303
foreach ($ this ->encoders as $ i => $ encoder ) {
302
- if ($ encoder ->supportsDecoding ($ format )) {
304
+ if ($ encoder instanceof DecoderInterface
305
+ && $ encoder ->supportsDecoding ($ format )
306
+ ) {
303
307
$ this ->decoderByFormat [$ format ] = $ i ;
304
308
return $ encoder ;
305
309
}
0 commit comments