Skip to content

Commit

Permalink
[Validator] Fixed exception thrown in Valid constraint to be thrown o…
Browse files Browse the repository at this point in the history
…nly when the options are not empty
  • Loading branch information
Bernhard Schussek authored and fabpot committed Nov 17, 2010
1 parent 940ce9a commit 46145d8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Symfony/Component/Validator/Constraints/Valid.php
Expand Up @@ -11,7 +11,7 @@
* with this source code in the file LICENSE.
*/

use Symfony\Component\Validator\Exception\InvalidOptionsException;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;

class Valid extends \Symfony\Component\Validator\Constraint
{
Expand All @@ -24,8 +24,8 @@ class Valid extends \Symfony\Component\Validator\Constraint
*/
public function __construct($options = null)
{
if (null !== $options) {
throw new InvalidOptionsException('The constraint Valid does not accept any options');
if ($options !== null && count($options) > 0) {
throw new ConstraintDefinitionException('The constraint Valid does not accept any options');
}
}
}

0 comments on commit 46145d8

Please sign in to comment.