Skip to content

Commit 4531816

Browse files
committed
merged branch romainneutron/DependencyInjectionExceptions (PR #5399)
Commits ------- f2e4802 [Yaml] Normalize exceptions b0f5f2e [Serializer] Normalize exceptions bcd8db2 [DependencyInjection] Normalize exceptions Discussion ---------- Normalize exceptions Bug fix: no Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes License of the code: MIT This PR adds consistence to components which already have their own exception interface. DependencyInjection, Serializer and Yaml now only throw their own scoped exceptions. For other components, it's much more work and could introduce some bugs. It would be better to do it in Symfony 2.2.
2 parents 6672ebc + 59c5013 commit 4531816

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)