Skip to content

Commit 59c5013

Browse files
committed
[Serializer] Normalize exceptions
1 parent 93998d3 commit 59c5013

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Normalizer/GetSetMethodNormalizer.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Serializer\Normalizer;
1313

14+
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
1415
use Symfony\Component\Serializer\Exception\RuntimeException;
1516

1617
/**
@@ -42,12 +43,14 @@ class GetSetMethodNormalizer extends SerializerAwareNormalizer implements Normal
4243
* Set normalization callbacks
4344
*
4445
* @param array $callbacks help normalize the result
46+
*
47+
* @throws InvalidArgumentException if a non-callable callback is set
4548
*/
4649
public function setCallbacks(array $callbacks)
4750
{
4851
foreach ($callbacks as $attribute => $callback) {
4952
if (!is_callable($callback)) {
50-
throw new \InvalidArgumentException(sprintf('The given callback for attribute "%s" is not callable.', $attribute));
53+
throw new InvalidArgumentException(sprintf('The given callback for attribute "%s" is not callable.', $attribute));
5154
}
5255
}
5356
$this->callbacks = $callbacks;

0 commit comments

Comments
 (0)