Commit 6f7d2ef1 authored by catch's avatar catch
Browse files

Issue #3232832 by daffie, longwave: [Symfony 6] Add various type hints to...

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 a7825ea9
Loading
Loading
Loading
Loading
+2 −2
Changes for core/modules/serialization/src/Encoder/JsonEncoder.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -37,14 +37,14 @@ public function __construct(JsonEncode $encodingImpl = NULL, JsonDecode $decodin
  /**
   * {@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);
  }

+4 −4
Changes for core/modules/serialization/src/Encoder/XmlEncoder.php: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -64,28 +64,28 @@ public function setBaseEncoder($encoder) {
  /**
   * {@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);
  }