Skip to content

Commit 2a24cb6

Browse files
theofidrynicolas-grekas
authored andcommitted
[Serializer] Add missing @throws annotations
1 parent c6f7814 commit 2a24cb6

10 files changed

+39
-1
lines changed

Encoder/ChainDecoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function supportsDecoding($format)
5959
*
6060
* @return DecoderInterface
6161
*
62-
* @throws RuntimeException if no decoder is found
62+
* @throws RuntimeException If no decoder is found.
6363
*/
6464
private function getDecoder($format)
6565
{

Encoder/DecoderInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Serializer\Encoder;
1313

14+
use Symfony\Component\Serializer\Exception\Exception;
15+
1416
/**
1517
* Defines the interface of decoders.
1618
*
@@ -30,6 +32,8 @@ interface DecoderInterface
3032
* are encouraged to document which formats they support in a non-inherited
3133
* phpdoc comment.
3234
*
35+
* @throws Exception
36+
*
3337
* @return mixed
3438
*/
3539
public function decode($data, $format, array $context = array());

Encoder/EncoderInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Serializer\Encoder;
1313

14+
use Symfony\Component\Serializer\Exception\Exception;
15+
1416
/**
1517
* Defines the interface of encoders.
1618
*
@@ -25,6 +27,8 @@ interface EncoderInterface
2527
* @param string $format Format name
2628
* @param array $context options that normalizers/encoders have access to.
2729
*
30+
* @throws Exception
31+
*
2832
* @return string|bool|int|float|null
2933
*/
3034
public function encode($data, $format, array $context = array());

Encoder/XmlEncoder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,8 @@ private function needsCdataWrapping($val)
399399
* @param \DOMNode $node
400400
* @param mixed $val
401401
*
402+
* @throws UnexpectedValueException
403+
*
402404
* @return bool
403405
*/
404406
private function selectNodeType(\DOMNode $node, $val)

Normalizer/DenormalizableInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Serializer\Normalizer;
1313

14+
use Symfony\Component\Serializer\Exception\Exception;
15+
1416
/**
1517
* Defines the most basic interface a class must implement to be denormalizable.
1618
*
@@ -33,6 +35,10 @@ interface DenormalizableInterface
3335
* @param string|null $format The format is optionally given to be able to denormalize differently
3436
* based on different input formats.
3537
* @param array $context options for denormalizing
38+
*
39+
* @throws Exception
40+
*
41+
* @return object
3642
*/
3743
public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array());
3844
}

Normalizer/DenormalizerInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Serializer\Normalizer;
1313

14+
use Symfony\Component\Serializer\Exception\Exception;
15+
1416
/**
1517
* Defines the interface of denormalizers.
1618
*
@@ -26,6 +28,8 @@ interface DenormalizerInterface
2628
* @param string $format format the given data was extracted from
2729
* @param array $context options available to the denormalizer
2830
*
31+
* @throws Exception
32+
*
2933
* @return object
3034
*/
3135
public function denormalize($data, $class, $format = null, array $context = array());

Normalizer/NormalizableInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Serializer\Normalizer;
1313

14+
use Symfony\Component\Serializer\Exception\Exception;
15+
1416
/**
1517
* Defines the most basic interface a class must implement to be normalizable.
1618
*
@@ -33,6 +35,8 @@ interface NormalizableInterface
3335
* based on different output formats.
3436
* @param array $context Options for normalizing this object
3537
*
38+
* @throws Exception
39+
*
3640
* @return array|string|bool|int|float|null
3741
*/
3842
public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array());

Normalizer/NormalizerInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Serializer\Normalizer;
1313

14+
use Symfony\Component\Serializer\Exception\Exception;
15+
1416
/**
1517
* Defines the interface of normalizers.
1618
*
@@ -25,6 +27,8 @@ interface NormalizerInterface
2527
* @param string $format format the normalization result will be encoded as
2628
* @param array $context Context options for the normalizer
2729
*
30+
* @throws Exception
31+
*
2832
* @return array|string|bool|int|float|null
2933
*/
3034
public function normalize($object, $format = null, array $context = array());

Serializer.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ public function supportsDenormalization($data, $type, $format = null)
169169

170170
/**
171171
* {@inheritdoc}
172+
*
173+
* @throws RuntimeException
172174
*/
173175
private function getNormalizer($data, $format = null)
174176
{
@@ -183,6 +185,8 @@ private function getNormalizer($data, $format = null)
183185

184186
/**
185187
* {@inheritdoc}
188+
*
189+
* @throws RuntimeException
186190
*/
187191
private function getDenormalizer($data, $type, $format = null)
188192
{

SerializerInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Serializer;
1313

14+
use Symfony\Component\Serializer\Exception\Exception;
15+
1416
/**
1517
* Defines the interface of the Serializer.
1618
*
@@ -25,6 +27,8 @@ interface SerializerInterface
2527
* @param string $format format name
2628
* @param array $context options normalizers/encoders have access to
2729
*
30+
* @throws Exception
31+
*
2832
* @return string
2933
*/
3034
public function serialize($data, $format, array $context = array());
@@ -37,6 +41,8 @@ public function serialize($data, $format, array $context = array());
3741
* @param string $format
3842
* @param array $context
3943
*
44+
* @throws Exception
45+
*
4046
* @return object
4147
*/
4248
public function deserialize($data, $type, $format, array $context = array());

0 commit comments

Comments
 (0)