Add return types to JsonSerializable implementations
This commit is contained in:
parent
6eead347b0
commit
9246b53f7c
@ -224,9 +224,6 @@ class JsonResponseTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->expectException(\Exception::class);
|
$this->expectException(\Exception::class);
|
||||||
$this->expectExceptionMessage('This error is expected');
|
$this->expectExceptionMessage('This error is expected');
|
||||||
if (!interface_exists(\JsonSerializable::class, false)) {
|
|
||||||
$this->markTestSkipped('JsonSerializable is required.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$serializable = new JsonSerializableObject();
|
$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');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ namespace Symfony\Component\Serializer\Tests\Fixtures;
|
|||||||
|
|
||||||
class JsonSerializableDummy implements \JsonSerializable
|
class JsonSerializableDummy implements \JsonSerializable
|
||||||
{
|
{
|
||||||
public function jsonSerialize()
|
public function jsonSerialize(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'foo' => 'a',
|
'foo' => 'a',
|
||||||
|
Reference in New Issue
Block a user