diff --git a/src/Symfony/Component/Validator/CHANGELOG.md b/src/Symfony/Component/Validator/CHANGELOG.md index b0f47b233b..fa26425aef 100644 --- a/src/Symfony/Component/Validator/CHANGELOG.md +++ b/src/Symfony/Component/Validator/CHANGELOG.md @@ -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 ----- diff --git a/src/Symfony/Component/Validator/DefaultTranslator.php b/src/Symfony/Component/Validator/DefaultTranslator.php index c46856752d..455729bc16 100644 --- a/src/Symfony/Component/Validator/DefaultTranslator.php +++ b/src/Symfony/Component/Validator/DefaultTranslator.php @@ -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 @@ class DefaultTranslator implements TranslatorInterface } 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,7 +56,7 @@ class DefaultTranslator implements TranslatorInterface */ public function setLocale($locale) { - throw new \BadMethodCallException('Unsupported method.'); + throw new BadMethodCallException('Unsupported method.'); } /** @@ -62,6 +64,6 @@ class DefaultTranslator implements TranslatorInterface */ public function getLocale() { - throw new \BadMethodCallException('Unsupported method.'); + throw new BadMethodCallException('Unsupported method.'); } } diff --git a/src/Symfony/Component/Validator/Exception/BadMethodCallException.php b/src/Symfony/Component/Validator/Exception/BadMethodCallException.php new file mode 100644 index 0000000000..939161bff3 --- /dev/null +++ b/src/Symfony/Component/Validator/Exception/BadMethodCallException.php @@ -0,0 +1,21 @@ + + * + * 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 + */ +class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface +{ +} diff --git a/src/Symfony/Component/Validator/Exception/ExceptionInterface.php b/src/Symfony/Component/Validator/Exception/ExceptionInterface.php new file mode 100644 index 0000000000..77d09b9029 --- /dev/null +++ b/src/Symfony/Component/Validator/Exception/ExceptionInterface.php @@ -0,0 +1,21 @@ + + * + * 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 + */ +interface ExceptionInterface +{ +} diff --git a/src/Symfony/Component/Validator/Exception/InvalidArgumentException.php b/src/Symfony/Component/Validator/Exception/InvalidArgumentException.php new file mode 100644 index 0000000000..22da39bb26 --- /dev/null +++ b/src/Symfony/Component/Validator/Exception/InvalidArgumentException.php @@ -0,0 +1,21 @@ + + * + * 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 + */ +class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface +{ +}