diff --git a/src/Symfony/Component/Form/ButtonBuilder.php b/src/Symfony/Component/Form/ButtonBuilder.php index 01f886a0fc..33bbbdc36d 100644 --- a/src/Symfony/Component/Form/ButtonBuilder.php +++ b/src/Symfony/Component/Form/ButtonBuilder.php @@ -79,9 +79,6 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface * * This method should not be invoked. * - * @param string|FormBuilderInterface $child - * @param string|FormTypeInterface $type - * * @throws BadMethodCallException */ public function add($child, $type = null, array $options = []) @@ -94,10 +91,6 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface * * This method should not be invoked. * - * @param string $name - * @param string|FormTypeInterface $type - * @param array $options - * * @throws BadMethodCallException */ public function create($name, $type = null, array $options = []) diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index aadab4d752..e7691cdbc1 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -849,8 +849,8 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac $child = (string) $child; - if (null !== $type && !\is_string($type) && !$type instanceof FormTypeInterface) { - throw new UnexpectedTypeException($type, 'string or Symfony\Component\Form\FormTypeInterface'); + if (null !== $type && !\is_string($type)) { + throw new UnexpectedTypeException($type, 'string or null'); } // Never initialize child forms automatically diff --git a/src/Symfony/Component/Form/FormBuilder.php b/src/Symfony/Component/Form/FormBuilder.php index 6b6a1728b2..87b4485a6f 100644 --- a/src/Symfony/Component/Form/FormBuilder.php +++ b/src/Symfony/Component/Form/FormBuilder.php @@ -66,8 +66,8 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB throw new UnexpectedTypeException($child, 'string or Symfony\Component\Form\FormBuilderInterface'); } - if (null !== $type && !\is_string($type) && !$type instanceof FormTypeInterface) { - throw new UnexpectedTypeException($type, 'string or Symfony\Component\Form\FormTypeInterface'); + if (null !== $type && !\is_string($type)) { + throw new UnexpectedTypeException($type, 'string or null'); } // Add to "children" to maintain order diff --git a/src/Symfony/Component/Form/Tests/FormBuilderTest.php b/src/Symfony/Component/Form/Tests/FormBuilderTest.php index 38d29a28d8..d831e0f3f2 100644 --- a/src/Symfony/Component/Form/Tests/FormBuilderTest.php +++ b/src/Symfony/Component/Form/Tests/FormBuilderTest.php @@ -120,13 +120,6 @@ class FormBuilderTest extends TestCase $this->assertSame(['foo', 'bar', 'baz'], array_keys($children)); } - public function testAddFormType() - { - $this->assertFalse($this->builder->has('foo')); - $this->builder->add('foo', $this->getMockBuilder('Symfony\Component\Form\FormTypeInterface')->getMock()); - $this->assertTrue($this->builder->has('foo')); - } - public function testRemove() { $this->builder->add('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType');