Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Form] type cannot be a FormTypeInterface anymore #32934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[Form] type cannot be a FormTypeInterface anymore
  • Loading branch information
Tobion committed Aug 4, 2019
commit 6ee0d53c31db757e38a2f54c298a0a3b0a868d17
7 changes: 0 additions & 7 deletions 7 src/Symfony/Component/Form/ButtonBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ public function __construct(?string $name, array $options = [])
*
* This method should not be invoked.
*
* @param string|FormBuilderInterface $child
xabbuh marked this conversation as resolved.
Show resolved Hide resolved
* @param string|FormTypeInterface $type
*
* @throws BadMethodCallException
*/
public function add($child, $type = null, array $options = [])
Expand All @@ -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 = [])
Expand Down
4 changes: 2 additions & 2 deletions 4 src/Symfony/Component/Form/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions 4 src/Symfony/Component/Form/FormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions 7 src/Symfony/Component/Form/Tests/FormBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.