diff --git a/src/Symfony/Component/Form/ButtonBuilder.php b/src/Symfony/Component/Form/ButtonBuilder.php index 01f886a0fc299..33bbbdc36de59 100644 --- a/src/Symfony/Component/Form/ButtonBuilder.php +++ b/src/Symfony/Component/Form/ButtonBuilder.php @@ -79,9 +79,6 @@ public function __construct(?string $name, array $options = []) * * 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 @@ public function add($child, $type = null, array $options = []) * * 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 aadab4d752284..e7691cdbc1b40 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -849,8 +849,8 @@ public function add($child, $type = null, array $options = []) $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 6b6a1728b2190..87b4485a6f11b 100644 --- a/src/Symfony/Component/Form/FormBuilder.php +++ b/src/Symfony/Component/Form/FormBuilder.php @@ -66,8 +66,8 @@ public function add($child, $type = null, array $options = []) 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 38d29a28d8132..d831e0f3f2958 100644 --- a/src/Symfony/Component/Form/Tests/FormBuilderTest.php +++ b/src/Symfony/Component/Form/Tests/FormBuilderTest.php @@ -120,13 +120,6 @@ public function testMaintainOrderOfLazyAndExplicitChildren() $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');