minor #18854 [Serializer] Add missing @throws annotations (theofidry)

This PR was squashed before being merged into the 2.3 branch (closes #18854).

Discussion
----------

[Serializer] Add missing @throws annotations

| Q             | A
| ------------- | ---
| Branch?       | 2.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #18798
| License       | MIT
| Doc PR        | -

Commits
-------

b73400d [Serializer] Add missing @throws annotations
This commit is contained in:
Nicolas Grekas 2016-05-30 10:12:16 +02:00
commit c58513457c
10 changed files with 39 additions and 1 deletions

View File

@ -59,7 +59,7 @@ class ChainDecoder implements DecoderInterface
* *
* @return DecoderInterface * @return DecoderInterface
* *
* @throws RuntimeException if no decoder is found * @throws RuntimeException If no decoder is found.
*/ */
private function getDecoder($format) private function getDecoder($format)
{ {

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Serializer\Encoder; namespace Symfony\Component\Serializer\Encoder;
use Symfony\Component\Serializer\Exception\Exception;
/** /**
* Defines the interface of decoders. * Defines the interface of decoders.
* *
@ -30,6 +32,8 @@ interface DecoderInterface
* are encouraged to document which formats they support in a non-inherited * are encouraged to document which formats they support in a non-inherited
* phpdoc comment. * phpdoc comment.
* *
* @throws Exception
*
* @return mixed * @return mixed
*/ */
public function decode($data, $format, array $context = array()); public function decode($data, $format, array $context = array());

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Serializer\Encoder; namespace Symfony\Component\Serializer\Encoder;
use Symfony\Component\Serializer\Exception\Exception;
/** /**
* Defines the interface of encoders. * Defines the interface of encoders.
* *
@ -25,6 +27,8 @@ interface EncoderInterface
* @param string $format Format name * @param string $format Format name
* @param array $context options that normalizers/encoders have access to. * @param array $context options that normalizers/encoders have access to.
* *
* @throws Exception
*
* @return string|bool|int|float|null * @return string|bool|int|float|null
*/ */
public function encode($data, $format, array $context = array()); public function encode($data, $format, array $context = array());

View File

@ -399,6 +399,8 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
* @param \DOMNode $node * @param \DOMNode $node
* @param mixed $val * @param mixed $val
* *
* @throws UnexpectedValueException
*
* @return bool * @return bool
*/ */
private function selectNodeType(\DOMNode $node, $val) private function selectNodeType(\DOMNode $node, $val)

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Serializer\Normalizer; namespace Symfony\Component\Serializer\Normalizer;
use Symfony\Component\Serializer\Exception\Exception;
/** /**
* Defines the most basic interface a class must implement to be denormalizable. * Defines the most basic interface a class must implement to be denormalizable.
* *
@ -33,6 +35,10 @@ interface DenormalizableInterface
* @param string|null $format The format is optionally given to be able to denormalize differently * @param string|null $format The format is optionally given to be able to denormalize differently
* based on different input formats. * based on different input formats.
* @param array $context options for denormalizing * @param array $context options for denormalizing
*
* @throws Exception
*
* @return object
*/ */
public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array()); public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array());
} }

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Serializer\Normalizer; namespace Symfony\Component\Serializer\Normalizer;
use Symfony\Component\Serializer\Exception\Exception;
/** /**
* Defines the interface of denormalizers. * Defines the interface of denormalizers.
* *
@ -26,6 +28,8 @@ interface DenormalizerInterface
* @param string $format format the given data was extracted from * @param string $format format the given data was extracted from
* @param array $context options available to the denormalizer * @param array $context options available to the denormalizer
* *
* @throws Exception
*
* @return object * @return object
*/ */
public function denormalize($data, $class, $format = null, array $context = array()); public function denormalize($data, $class, $format = null, array $context = array());

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Serializer\Normalizer; namespace Symfony\Component\Serializer\Normalizer;
use Symfony\Component\Serializer\Exception\Exception;
/** /**
* Defines the most basic interface a class must implement to be normalizable. * Defines the most basic interface a class must implement to be normalizable.
* *
@ -33,6 +35,8 @@ interface NormalizableInterface
* based on different output formats. * based on different output formats.
* @param array $context Options for normalizing this object * @param array $context Options for normalizing this object
* *
* @throws Exception
*
* @return array|string|bool|int|float|null * @return array|string|bool|int|float|null
*/ */
public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array()); public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array());

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Serializer\Normalizer; namespace Symfony\Component\Serializer\Normalizer;
use Symfony\Component\Serializer\Exception\Exception;
/** /**
* Defines the interface of normalizers. * Defines the interface of normalizers.
* *
@ -25,6 +27,8 @@ interface NormalizerInterface
* @param string $format format the normalization result will be encoded as * @param string $format format the normalization result will be encoded as
* @param array $context Context options for the normalizer * @param array $context Context options for the normalizer
* *
* @throws Exception
*
* @return array|string|bool|int|float|null * @return array|string|bool|int|float|null
*/ */
public function normalize($object, $format = null, array $context = array()); public function normalize($object, $format = null, array $context = array());

View File

@ -169,6 +169,8 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @throws RuntimeException
*/ */
private function getNormalizer($data, $format = null) private function getNormalizer($data, $format = null)
{ {
@ -183,6 +185,8 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @throws RuntimeException
*/ */
private function getDenormalizer($data, $type, $format = null) private function getDenormalizer($data, $type, $format = null)
{ {

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Serializer; namespace Symfony\Component\Serializer;
use Symfony\Component\Serializer\Exception\Exception;
/** /**
* Defines the interface of the Serializer. * Defines the interface of the Serializer.
* *
@ -25,6 +27,8 @@ interface SerializerInterface
* @param string $format format name * @param string $format format name
* @param array $context options normalizers/encoders have access to * @param array $context options normalizers/encoders have access to
* *
* @throws Exception
*
* @return string * @return string
*/ */
public function serialize($data, $format, array $context = array()); public function serialize($data, $format, array $context = array());
@ -37,6 +41,8 @@ interface SerializerInterface
* @param string $format * @param string $format
* @param array $context * @param array $context
* *
* @throws Exception
*
* @return object * @return object
*/ */
public function deserialize($data, $type, $format, array $context = array()); public function deserialize($data, $type, $format, array $context = array());