Commit cdc1101
committed
minor symfony#59306 [Serializer] Document
This PR was submitted for the 6.4 branch but it was squashed and merged into the 7.3 branch instead.
Discussion
----------
[Serializer] Document `SerializerInterface` exceptions
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | not really, just PHPDoc
| New feature? | no
| Deprecations? | no
| Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead -->
| License | MIT
This
- warns the developper that calls to SerializerInterface::serialize and deserialize might throws exception
- avoid PHPStan to report useless try/catch when writing
```
try {
$serializer->serialize(...);
} catch (NotEncodableValueException) {} // for instance
```
SerializerInterface::serialize can throws
- NotEncodableValueException
- all exceptions thrown by NormalizerInterface::normalize
- all exceptions thrown by EncoderInterface::encode
Since it might be a lot of exception and there is no real need to list them all, I simplified with ``@throws` ExceptionInterface`.
Commits
-------
a6aeb65 [Serializer] Document `SerializerInterface` exceptionsSerializerInterface exceptions (VincentLanglet)1 file changed
+12
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
| |||
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
23 | 31 | | |
24 | 32 | | |
25 | 33 | | |
| |||
35 | 43 | | |
36 | 44 | | |
37 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
38 | 50 | | |
39 | 51 | | |
40 | 52 | | |
0 commit comments