Skip to content

Commit

Permalink
minor #22231 [DX] Fix phpdoc for serializer normalizers exceptions (N…
Browse files Browse the repository at this point in the history
…ek-)

This PR was submitted for the master branch but it was merged into the 3.2 branch instead (closes #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 | #22218
| License       | MIT
| Doc PR        | Not needed

Commits
-------

ec3cc84 Fix phpdoc for serializer normalizers exceptions
  • Loading branch information
fabpot committed Jul 6, 2017
2 parents 15938b4 + ec3cc84 commit de820d1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
Expand Up @@ -13,7 +13,6 @@

use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Exception\CircularReferenceException;
use Symfony\Component\Serializer\Exception\LogicException;
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
Expand Down Expand Up @@ -52,8 +51,6 @@ public function supportsNormalization($data, $format = null)

/**
* {@inheritdoc}
*
* @throws CircularReferenceException
*/
public function normalize($object, $format = null, array $context = array())
{
Expand Down
Expand Up @@ -31,8 +31,6 @@ class ArrayDenormalizer implements DenormalizerInterface, SerializerAwareInterfa

/**
* {@inheritdoc}
*
* @throws UnexpectedValueException
*/
public function denormalize($data, $class, $format = null, array $context = array())
{
Expand Down
Expand Up @@ -79,9 +79,6 @@ public function supportsNormalization($data, $format = null)
* Regex adapted from Brian Grinstead code.
*
* @see https://gist.github.com/bgrins/6194623
*
* @throws InvalidArgumentException
* @throws UnexpectedValueException
*/
public function denormalize($data, $class, $format = null, array $context = array())
{
Expand Down
Expand Up @@ -11,6 +11,13 @@

namespace Symfony\Component\Serializer\Normalizer;

use Symfony\Component\Serializer\Exception\BadMethodCallException;
use Symfony\Component\Serializer\Exception\ExtraAttributesException;
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
use Symfony\Component\Serializer\Exception\LogicException;
use Symfony\Component\Serializer\Exception\RuntimeException;
use Symfony\Component\Serializer\Exception\UnexpectedValueException;

/**
* Defines the interface of denormalizers.
*
Expand All @@ -27,6 +34,13 @@ interface DenormalizerInterface
* @param array $context options available to the denormalizer
*
* @return object
*
* @throws BadMethodCallException Occurs when the normalizer is not called in an expected context
* @throws InvalidArgumentException Occurs when the arguments are not coherent or not supported
* @throws UnexpectedValueException Occurs when the item cannot be hydrated with the given data
* @throws ExtraAttributesException Occurs when the item doesn't have attribute to receive given data
* @throws LogicException Occurs when the normalizer is not supposed to denormalize
* @throws RuntimeException Occurs if the class cannot be instantiated
*/
public function denormalize($data, $class, $format = null, array $context = array());

Expand Down
Expand Up @@ -11,6 +11,10 @@

namespace Symfony\Component\Serializer\Normalizer;

use Symfony\Component\Serializer\Exception\CircularReferenceException;
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
use Symfony\Component\Serializer\Exception\LogicException;

/**
* Defines the interface of normalizers.
*
Expand All @@ -26,6 +30,11 @@ interface NormalizerInterface
* @param array $context Context options for the normalizer
*
* @return array|scalar
*
* @throws InvalidArgumentException Occurs when the object given is not an attempted type for the normalizer
* @throws CircularReferenceException Occurs when the normalizer detects a circular reference when no circular
* reference handler can fix it
* @throws LogicException Occurs when the normalizer is not called in an expected context
*/
public function normalize($object, $format = null, array $context = array());

Expand Down

0 comments on commit de820d1

Please sign in to comment.