8000 [Serializer] Document `SerializerInterface` exceptions · symfony/symfony@a6aeb65 · GitHub
[go: up one dir, main page]

Skip to content

Commit a6aeb65

Browse files
VincentLangletnicolas-grekas
authored andcommitted
[Serializer] Document SerializerInterface exceptions
1 parent 18d08ff commit a6aeb65

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Symfony/Component/Serializer/SerializerInterface.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111

1212
namespace Symfony\Component\Serializer;
1313

14+
use Symfony\Component\Serializer\Exception\ExceptionInterface;
15+
use Symfony\Component\Serializer\Exception\NotNormalizableValueException;
16+
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
17+
1418
/**
1519
* @author Jordi Boggiano <j.boggiano@seld.be>
1620
*/
@@ -20,6 +24,10 @@ interface SerializerInterface
2024
* Serializes data in the appropriate format.
2125
*
2226
* @param array<string, mixed> $context Options normalizers/encoders have access to
27+
*
28+
* @throws NotNormalizableValueException Occurs when a value cannot be normalized
29+
* @throws UnexpectedValueException Occurs when a value cannot be encoded
30+
* @throws ExceptionInterface Occurs for all the other cases of serialization-related errors
2331
*/
2432
public function serialize(mixed $data, string $format, array $context = []): string;
2533

@@ -35,6 +43,10 @@ public function serialize(mixed $data, string $format, array $context = []): str
3543
* @psalm-return (TType is class-string<TObject> ? TObject : mixed)
3644
*
3745
* @phpstan-return ($type is class-string<TObject> ? TObject : mixed)
46+
*
47+
* @throws NotNormalizableValueException Occurs when a value cannot be denormalized
48+
* @throws UnexpectedValueException Occurs when a value cannot be decoded
49+
* @throws ExceptionInterface Occurs for all the other cases of serialization-related errors
3850
*/
3951
public function deserialize(mixed $data, string $type, string $format, array $context = []): mixed;
4052
}

0 commit comments

Comments
 (0)
0