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()
parent
a7825ea91a
commit
6f7d2ef1c3
|
@ -37,14 +37,14 @@ class JsonEncoder extends BaseJsonEncoder {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supportsEncoding($format) {
|
||||
public function supportsEncoding($format): bool {
|
||||
return in_array($format, static::$format);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supportsDecoding($format) {
|
||||
public function supportsDecoding($format): bool {
|
||||
return in_array($format, static::$format);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,28 +64,28 @@ class XmlEncoder implements SerializerAwareInterface, EncoderInterface, DecoderI
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function encode($data, $format, array $context = []) {
|
||||
public function encode($data, $format, array $context = []): string {
|
||||
return $this->getBaseEncoder()->encode($data, $format, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supportsEncoding($format) {
|
||||
public function supportsEncoding($format): bool {
|
||||
return in_array($format, static::$format);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function decode($data, $format, array $context = []) {
|
||||
public function decode($data, $format, array $context = []): mixed {
|
||||
return $this->getBaseEncoder()->decode($data, $format, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supportsDecoding($format) {
|
||||
public function supportsDecoding($format): bool {
|
||||
return in_array($format, static::$format);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue