[Form] type cannot be a FormTypeInterface anymore
This commit is contained in:
parent
64a2627e9c
commit
6ee0d53c31
@ -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 = [])
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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');
|
||||
|
Reference in New Issue
Block a user