[Form] Fixed invalid use of FormException

This commit is contained in:
Bernhard Schussek 2013-04-11 16:56:20 +02:00
parent 600007b71f
commit 0bc7129eb1
2 changed files with 23 additions and 1 deletions

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Form;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\Exception\FormException;
use Symfony\Component\Form\Exception\InvalidArgumentException;
/**
* A builder for {@link Button} instances.
@ -62,7 +63,7 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
public function __construct($name, array $options)
{
if (empty($name) && 0 != $name) {
throw new FormException('Buttons cannot have empty names.');
throw new InvalidArgumentException('Buttons cannot have empty names.');
}
$this->name = (string) $name;

View File

@ -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\Form\Exception;
/**
* Base InvalidArgumentException for the Form component.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{
}