diff --git a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php index 664f577b17..9cd63da728 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php @@ -224,9 +224,6 @@ class JsonResponseTest extends TestCase { $this->expectException(\Exception::class); $this->expectExceptionMessage('This error is expected'); - if (!interface_exists(\JsonSerializable::class, false)) { - $this->markTestSkipped('JsonSerializable is required.'); - } $serializable = new JsonSerializableObject(); @@ -280,12 +277,10 @@ class JsonResponseTest extends TestCase } } -if (interface_exists(\JsonSerializable::class, false)) { - class JsonSerializableObject implements \JsonSerializable +class JsonSerializableObject implements \JsonSerializable +{ + public function jsonSerialize(): array { - public function jsonSerialize() - { - throw new \Exception('This error is expected'); - } + throw new \Exception('This error is expected'); } } diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/JsonSerializableDummy.php b/src/Symfony/Component/Serializer/Tests/Fixtures/JsonSerializableDummy.php index 958200fdc7..ed4fd7e5e7 100644 --- a/src/Symfony/Component/Serializer/Tests/Fixtures/JsonSerializableDummy.php +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/JsonSerializableDummy.php @@ -13,7 +13,7 @@ namespace Symfony\Component\Serializer\Tests\Fixtures; class JsonSerializableDummy implements \JsonSerializable { - public function jsonSerialize() + public function jsonSerialize(): array { return [ 'foo' => 'a',