WordPress.org

Make WordPress Core

Ticket #53635: 53635-jsonserialize.patch

File 53635-jsonserialize.patch, 847 bytes (added by jrf, 2 months ago)

Fix a "SomeClass::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed" error

  • tests/phpunit/includes/class-jsonserializable-object.php

    From c5f8021f863d3f027d99b0a516e1ffc43a1fa2a5 Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Tue, 20 Jul 2021 19:19:18 +0200
    Subject: [PATCH] PHP 8.1: silence deprecation warning about missing return
     type
    
    ---
     tests/phpunit/includes/class-jsonserializable-object.php | 1 +
     1 file changed, 1 insertion(+)
    
    diff --git a/tests/phpunit/includes/class-jsonserializable-object.php b/tests/phpunit/includes/class-jsonserializable-object.php
    index eb4ae5c3af..e235327020 100644
    a b class JsonSerializable_Object implements JsonSerializable { 
    1515                $this->data = $data;
    1616        }
    1717
     18        #[ReturnTypeWillChange]
    1819        public function jsonSerialize() {
    1920                return $this->data;
    2021        }