You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (!\method_exists($this->serializer, 'serialize')) {
32
30
thrownew \RuntimeException('The serializer must have a "serialize" method.');
33
31
}
32
+
33
+
return$this;
34
34
}
35
35
36
-
publicfunctionsetGroups(array$groups): void
36
+
publicfunctionsetGroups(array$groups): self
37
37
{
38
38
$this->groups = $groups;
39
39
40
40
if (!empty($this->groups) && !$this->serializerinstanceof SerializerInterface && !$this->serializerinstanceof JMSSerializer) {
41
-
thrownew \RuntimeException('Setting serialization groups requires using "JMS\Serializer\Serializer" or "Symfony\Component\Serializer\Serializer".');
41
+
thrownew \RuntimeException(\sprintf('Setting serialization groups requires using a "%s" or "%s" serializer instance.', SerializerInterface::class, JMSSerializer::class));
42
42
}
43
+
44
+
return$this;
43
45
}
44
46
45
-
/**
46
-
* @param mixed $version
47
-
*/
48
-
publicfunctionsetVersion($version): void
47
+
publicfunctionsetVersion(string$version): self
49
48
{
50
49
$this->version = $version;
51
50
52
51
if ($this->version && !$this->serializerinstanceof JMSSerializer) {
53
-
thrownew \RuntimeException('Setting serialization version requires using "JMS\Serializer\Serializer".');
52
+
thrownew \RuntimeException(\sprintf('Setting serialization version requires using a "%s" serializer instance.', JMSSerializer::class));
thrownew \RuntimeException('Setting null value serialization option requires using "JMS\Serializer\Serializer" or "Symfony\Component\Serializer\Serializer".');
63
+
thrownew \RuntimeException(\sprintf('Setting null value serialization option requires using a "%s" or "%s" serializer instance.', SerializerInterface::class, JMSSerializer::class));
Copy file name to clipboardExpand all lines: tests/Unit/Serializer/CallbackTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ public function testSetGroupsFailsWithInvalidSerializer()
42
42
43
43
$this->expectException(\RuntimeException::class);
44
44
$this->expectExceptionMessage(
45
-
'Setting serialization groups requires using "JMS\Serializer\Serializer" or "Symfony\Component\Serializer\Serializer"'
45
+
'Setting serialization groups requires using a "Symfony\Component\Serializer\SerializerInterface" or "JMS\Serializer\SerializerInterface" serializer instance.'
0 commit comments