Issue #3232832 by daffie, longwave: [Symfony 6] Add various type hints to Drupal\serialization\Encoder\JsonEncoder::supportsEncoding() and ::supportsDecoding() and Drupal\serialization\Encoder\XmlEncoder::supportsEncoding(), ::encode(), ::decode() and ::supportsDecoding()

merge-requests/1492/merge
catch 2021-12-13 12:51:40 +00:00
parent a7825ea91a
commit 6f7d2ef1c3
2 changed files with 6 additions and 6 deletions

View File

@ -37,14 +37,14 @@ class JsonEncoder extends BaseJsonEncoder {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function supportsEncoding($format) { public function supportsEncoding($format): bool {
return in_array($format, static::$format); return in_array($format, static::$format);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function supportsDecoding($format) { public function supportsDecoding($format): bool {
return in_array($format, static::$format); return in_array($format, static::$format);
} }

View File

@ -64,28 +64,28 @@ class XmlEncoder implements SerializerAwareInterface, EncoderInterface, DecoderI
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function encode($data, $format, array $context = []) { public function encode($data, $format, array $context = []): string {
return $this->getBaseEncoder()->encode($data, $format, $context); return $this->getBaseEncoder()->encode($data, $format, $context);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function supportsEncoding($format) { public function supportsEncoding($format): bool {
return in_array($format, static::$format); return in_array($format, static::$format);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function decode($data, $format, array $context = []) { public function decode($data, $format, array $context = []): mixed {
return $this->getBaseEncoder()->decode($data, $format, $context); return $this->getBaseEncoder()->decode($data, $format, $context);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function supportsDecoding($format) { public function supportsDecoding($format): bool {
return in_array($format, static::$format); return in_array($format, static::$format);
} }