Fix phpdoc for serializer normalizers exceptions
The normalizers throw exceptions. They need to be documented for DX in the normalizer/denormalizer interfaces. [Serializer] fit Symfony phpdoc standard It also adds meaning of each exception throw. Fix grammary in phpdoc
This commit is contained in:
parent
15938b4ffd
commit
ec3cc84656
@ -13,7 +13,6 @@ namespace Symfony\Component\Serializer\Normalizer;
|
||||
|
||||
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;
|
||||
@ -52,8 +51,6 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws CircularReferenceException
|
||||
*/
|
||||
public function normalize($object, $format = null, array $context = array())
|
||||
{
|
||||
|
@ -31,8 +31,6 @@ class ArrayDenormalizer implements DenormalizerInterface, SerializerAwareInterfa
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws UnexpectedValueException
|
||||
*/
|
||||
public function denormalize($data, $class, $format = null, array $context = array())
|
||||
{
|
||||
|
@ -79,9 +79,6 @@ class DataUriNormalizer implements NormalizerInterface, DenormalizerInterface
|
||||
* 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())
|
||||
{
|
||||
|
@ -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.
|
||||
*
|
||||
@ -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());
|
||||
|
||||
|
@ -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.
|
||||
*
|
||||
@ -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());
|
||||
|
||||
|
Reference in New Issue
Block a user