Skip to content

Commit af10b21

Browse files
committed
[Serializer] fit Symfony phpdoc standard
It also adds meaning of each exception throw.
1 parent f05d0ed commit af10b21

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php

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

1212
namespace Symfony\Component\Serializer\Normalizer;
1313

14+
use Symfony\Component\Serializer\Exception\BadMethodCallException;
15+
use Symfony\Component\Serializer\Exception\ExtraAttributesException;
16+
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
17+
use Symfony\Component\Serializer\Exception\LogicException;
18+
use Symfony\Component\Serializer\Exception\RuntimeException;
19+
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
20+
1421
/**
1522
* Defines the interface of denormalizers.
1623
*
@@ -28,12 +35,12 @@ interface DenormalizerInterface
2835
*
2936
* @return object
3037
*
31-
* @throws \Symfony\Component\Serializer\Exception\BadMethodCallException
32-
* @throws \Symfony\Component\Serializer\Exception\InvalidArgumentException
33-
* @throws \Symfony\Component\Serializer\Exception\UnexpectedValueException
34-
* @throws \Symfony\Component\Serializer\Exception\ExtraAttributesException
35-
* @throws \Symfony\Component\Serializer\Exception\LogicException
36-
* @throws \Symfony\Component\Serializer\Exception\RuntimeException
38+
* @throws BadMethodCallException Occurs when the normalizer is not call in an expected context
39+
* @throws InvalidArgumentException Occurs when the arguments are not coherent or not supported
40+
* @throws UnexpectedValueException Occurs when the item cannot be hydrated with the given data
41+
* @throws ExtraAttributesException Occurs when the item doesn't have attribute to receive given data
42+
* @throws LogicException Occurs when the normalizer is not supposed to denormalize
43+
* @throws RuntimeException Occurs if the class cannot be instantiate
3744
*/
3845
public function denormalize($data, $class, $format = null, array $context = array());
3946

src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php

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

1212
namespace Symfony\Component\Serializer\Normalizer;
1313

14+
use Symfony\Component\Serializer\Exception\CircularReferenceException;
15+
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
16+
use Symfony\Component\Serializer\Exception\LogicException;
17+
1418
/**
1519
* Defines the interface of normalizers.
1620
*
@@ -27,9 +31,10 @@ interface NormalizerInterface
2731
*
2832
* @return array|scalar
2933
*
30-
* @throws \Symfony\Component\Serializer\Exception\InvalidArgumentException
31-
* @throws \Symfony\Component\Serializer\Exception\LogicException
32-
* @throws \Symfony\Component\Serializer\Exception\CircularReferenceException
34+
* @throws InvalidArgumentException Occurs when the object given is not an attempted type for the normalizer
35+
* @throws CircularReferenceException Occurs when the normalizer detect a circular reference when no circular
36+
* reference handler can fix it
37+
* @throws LogicException Occurs when the normalizer is not call in an expected context
3338
*/
3439
public function normalize($object, $format = null, array $context = array());
3540

0 commit comments

Comments
 (0)