8000 Add return types to JsonSerializable implementations · symfony/symfony@9246b53 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9246b53

Browse files
committed
Add return types to JsonSerializable implementations
1 parent 6eead34 commit 9246b53

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,6 @@ public function testSetContentJsonSerializeError()
224224
{
225225
$this->expectException(\Exception::class);
226226
$this->expectExceptionMessage('This error is expected');
227-
if (!interface_exists(\JsonSerializable::class, false)) {
228-
$this->markTestSkipped('JsonSerializable is required.');
229-
}
230227

231228
$serializable = new JsonSerializableObject();
232229

@@ -280,12 +277,10 @@ public function testConstructorWithObjectWithoutToStringMethodThrowsAnException(
280277
}
281278
}
282279

283-
if (interface_exists(\JsonSerializable::class, false)) {
284-
class JsonSerializableObject implements \JsonSerializable
280+
class JsonSerializableObject implements \JsonSerializable
281+
{
282+
public function jsonSerialize(): array
285283
{
286-
public function jsonSerialize()
287-
{
288-
throw new \Exception('This error is expected');
289-
}
284+
throw new \Exception('This error is expected');
290285
}
291286
}

src/Symfony/Component/Serializer/Tests/Fixtures/JsonSerializableDummy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
class JsonSerializableDummy implements \JsonSerializable
1515
{
16-
public function jsonSerialize()
16+
public function jsonSerialize(): array
1717
{
1818
return [
1919
'foo' => 'a',

0 commit comments

Comments
 (0)
0