Skip to content

Commit de820d1

Browse files
committed
minor symfony#22231 [DX] Fix phpdoc for serializer normalizers exceptions (Nek-)
This PR was submitted for the master branch but it was merged into the 3.2 branch instead (closes symfony#22231). Discussion ---------- [DX] Fix phpdoc for serializer normalizers exceptions The normalizers throw exceptions. They need to be documented for DX in the normalizer/denormalizer interfaces. | Q | A | ------------- | --- | Branch? | master (rebase on 2.7 if you want?) | Bug fix? | no | New feature? | yes? | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#22218 | License | MIT | Doc PR | Not needed Commits ------- ec3cc84 Fix phpdoc for serializer normalizers exceptions
2 parents 15938b4 + ec3cc84 commit de820d1

File tree

5 files changed

+23
-8
lines changed

5 files changed

+23
-8
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException;
1515
use Symfony\Component\Serializer\Encoder\JsonEncoder;
16-
use Symfony\Component\Serializer\Exception\CircularReferenceException;
1716
use Symfony\Component\Serializer\Exception\LogicException;
1817
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
1918
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
@@ -52,8 +51,6 @@ public function supportsNormalization($data, $format = null)
5251

5352
/**
5453
* {@inheritdoc}
55-
*
56-
* @throws CircularReferenceException
5754
*/
5855
public function normalize($object, $format = null, array $context = array())
5956
{

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ class ArrayDenormalizer implements DenormalizerInterface, SerializerAwareInterfa
3131

3232
/**
3333
* {@inheritdoc}
34-
*
35-
* @throws UnexpectedValueException
3634
*/
3735
public function denormalize($data, $class, $format = null, array $context = array())
3836
{

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ public function supportsNormalization($data, $format = null)
7979
* Regex adapted from Brian Grinstead code.
8080
*
8181
* @see https://gist.github.com/bgrins/6194623
82-
*
83-
* @throws InvalidArgumentException
84-
* @throws UnexpectedValueException
8582
*/
8683
public function denormalize($data, $class, $format = null, array $context = array())
8784
{

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

Lines changed: 14 additions & 0 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
*
@@ -27,6 +34,13 @@ interface DenormalizerInterface
2734
* @param array $context options available to the denormalizer
2835
*
2936
* @return object
37+
*
38+
* @throws BadMethodCallException Occurs when the normalizer is not called 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 instantiated
3044
*/
3145
public function denormalize($data, $class, $format = null, array $context = array());
3246

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

Lines changed: 9 additions & 0 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
*
@@ -26,6 +30,11 @@ interface NormalizerInterface
2630
* @param array $context Context options for the normalizer
2731
*
2832
* @return array|scalar
33+
*
34+
* @throws InvalidArgumentException Occurs when the object given is not an attempted type for the normalizer
35+
* @throws CircularReferenceException Occurs when the normalizer detects a circular reference when no circular
36+
* reference handler can fix it
37+
* @throws LogicException Occurs when the normalizer is not called in an expected context
2938
*/
3039
public function normalize($object, $format = null, array $context = array());
3140

0 commit comments

Comments
 (0)