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
*
* @throws RuntimeException if no decoder is found
* @throws RuntimeException If no decoder is found.
*/
private function getDecoder($format)
{

View File

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

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Serializer\Encoder;
use Symfony\Component\Serializer\Exception\Exception;
/**
* Defines the interface of encoders.
*
@ -25,6 +27,8 @@ interface EncoderInterface
* @param string $format Format name
* @param array $context options that normalizers/encoders have access to.
*
* @throws Exception
*
* @return string|bool|int|float|null
*/
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 mixed $val
*
* @throws UnexpectedValueException
*
* @return bool
*/
private function selectNodeType(\DOMNode $node, $val)

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Serializer\Normalizer;
use Symfony\Component\Serializer\Exception\Exception;
/**
* 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
* based on different input formats.
* @param array $context options for denormalizing
*
* @throws Exception
*
* @return object
*/
public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array());
}

View File

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

View File

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

View File

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

View File

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

View File

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