Permalink
Browse files

[Validator] Added ExceptionInterface, BadMethodCallException and Inva…

…lidArgumentException
  • Loading branch information...
webmozart committed Jan 8, 2013
1 parent 5aa5a55 commit f98305af1092e535708cc23b43a9e5e4b289cc5c
View
@@ -38,6 +38,7 @@ CHANGELOG
* [BC BREAK] added `setTranslator()` and `setTranslationDomain()` to `ValidatorBuilderInterface`
* improved the Validator to support pluralized messages by default
* [BC BREAK] changed the source of all pluralized messages in the translation files to the pluralized version
+ * added ExceptionInterface, BadMethodCallException and InvalidArgumentException
2.1.0
-----
View
@@ -11,6 +11,8 @@
namespace Symfony\Component\Validator;
+use Symfony\Component\Validator\Exception\BadMethodCallException;
+use Symfony\Component\Validator\Exception\InvalidArgumentException;
use Symfony\Component\Translation\TranslatorInterface;
/**
@@ -43,7 +45,7 @@ public function transChoice($id, $number, array $parameters = array(), $domain =
}
if (!isset($ids[1])) {
- throw new \InvalidArgumentException(sprintf('The message "%s" cannot be pluralized, because it is missing a plural (e.g. "There is one apple|There are %%count%% apples").', $id));
+ throw new InvalidArgumentException(sprintf('The message "%s" cannot be pluralized, because it is missing a plural (e.g. "There is one apple|There are %%count%% apples").', $id));
}
return strtr($ids[1], $parameters);
@@ -54,14 +56,14 @@ public function transChoice($id, $number, array $parameters = array(), $domain =
*/
public function setLocale($locale)
{
- throw new \BadMethodCallException('Unsupported method.');
+ throw new BadMethodCallException('Unsupported method.');
}
/**
* {@inheritdoc}
*/
public function getLocale()
{
- throw new \BadMethodCallException('Unsupported method.');
+ throw new BadMethodCallException('Unsupported method.');
}
}
@@ -0,0 +1,21 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Validator\Exception;
+
+/**
+ * Base BadMethodCallException for the Validator component.
+ *
+ * @author Bernhard Schussek <bschussek@gmail.com>
+ */
+class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface
+{
+}
@@ -0,0 +1,21 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Validator\Exception;
+
+/**
+ * Base ExceptionInterface for the Validator component.
+ *
+ * @author Bernhard Schussek <bschussek@gmail.com>
+ */
+interface ExceptionInterface
+{
+}
@@ -0,0 +1,21 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Validator\Exception;
+
+/**
+ * Base InvalidArgumentException for the Validator component.
+ *
+ * @author Bernhard Schussek <bschussek@gmail.com>
+ */
+class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
+{
+}

0 comments on commit f98305a

Please sign in to comment.