Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9246b53

Browse filesBrowse files
committed
Add return types to JsonSerializable implementations
1 parent 6eead34 commit 9246b53
Copy full SHA for 9246b53

File tree

Expand file treeCollapse file tree

2 files changed

+5
-10
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-10
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php
+4-9Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Tests/Fixtures/JsonSerializableDummy.php
+1-1Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.