8000 [Validator] Added ExceptionInterface, BadMethodCallException and Inva… · symfony/symfony@cd662cc · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cd662cc

Browse files
committed
[Validator] Added ExceptionInterface, BadMethodCallException and InvalidArgumentException
1 parent e00e5ec commit cd662cc

File tree

5 files changed

+69
-3
lines changed

5 files changed

+69
-3
lines changed

src/Symfony/Component/Validator/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ CHANGELOG
3838
* [BC BREAK] added `setTranslator()` and `setTranslationDomain()` to `ValidatorBuilderInterface`
3939
* improved the Validator to support pluralized messages by default
4040
* [BC BREAK] changed the source of all pluralized messages in the translation files to the pluralized version
41+
* added ExceptionInterface, BadMethodCallException and InvalidArgumentException
4142

4243
2.1.0
4344
-----

src/Symfony/Component/Validator/DefaultTranslator.php

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

1212
namespace Symfony\Component\Validator;
1313

14+
use Symfony\Component\Validator\Exception\BadMethodCallException;
15+
use Symfony\Component\Validator\Exception\InvalidArgumentException;
1416
use Symfony\Component\Translation\TranslatorInterface;
1517

1618
/**
@@ -43,7 +45,7 @@ public function transChoice($id, $number, array $parameters = array(), $domain =
4345
}
4446

4547
if (!isset($ids[1])) {
46-
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));
48+
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));
4749
}
4850

4951
return strtr($ids[1], $parameters);
@@ -54,14 +56,14 @@ public function transChoice($id, $number, array $parameters = array(), $domain =
5456
*/
5557
public function setLocale($locale)
5658
{
57-
throw new \BadMethodCallException('Unsupported method.');
59+
throw new BadMethodCallException('Unsupported method.');
5860
}
5961

6062
/**
6163
* {@inheritdoc}
6264
*/
6365
public function getLocale()
6466
{
65-
throw new \BadMethodCallException('Unsupported method.');
67+
throw new BadMethodCallException('Unsupported method.');
6668
}
6769
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Validator\Exception;
13+
14+
/**
15+
* Base BadMethodCallException for the Validator component.
16+
*
17+
* @author Bernhard Schussek <bschussek@gmail.com>
18+
*/
19+
class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface
20+
{
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Validator\Exception;
13+
14+
/**
15+
* Base ExceptionInterface for the Validator component.
16+
*
17+
* @author Bernhard Schussek <bschussek@gmail.com>
18+
*/
19+
interface ExceptionInterface
20+
{
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Validator\Exception;
13+
14+
/**
15+
* Base InvalidArgumentException for the Validator component.
16+
*
17+
* @author Bernhard Schussek <bschussek@gmail.com>
18+
*/
19+
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
20+
{
21+
}

0 commit comments

Comments
 (0)
0