8000 [Form] fix parameter type declaration and make fabbot happy by xabbuh · Pull Request #33349 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] fix parameter type declaration and make fabbot happy #33349

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 27, 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
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/FormInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
* @throws Exception\LogicException when trying to set a parent for a form with
* an empty name
*/
public function setParent(FormInterface $parent = null);
public function setParent(self $parent = null);

/**
* Returns the parent form.
Expand Down
14 changes: 11 additions & 3 deletions src/Symfony/Component/Form/Tests/FormFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@

use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormTypeGuesserChain;
use Symfony\Component\Form\Guess\Guess;
use Symfony\Component\Form\Guess\TypeGuess;
Expand Down Expand Up @@ -194,7 +195,7 @@ public function testCreateUsesBlockPrefixIfTypeGivenAsString()
->method('buildForm')
->with($this->builder, $resolvedOptions);

$form = $this->createMock(FormInterface::class);
$form = $this->createForm();

$this->builder->expects($this->once())
->method('getForm')
Expand Down Expand Up @@ -227,7 +228,7 @@ public function testCreateNamed()
->method('buildForm')
->with($this->builder, $resolvedOptions);

$form = $this->createMock(FormInterface::class);
$form = $this->createForm();

$this->builder->expects($this->once())
->method('getForm')
Expand Down Expand Up @@ -467,6 +468,13 @@ public function testCreateBuilderUsesPatternIfFound()
$this->assertSame($this->builder, $this->builder);
}

protected function createForm()
{
$formBuilder = new FormBuilder('', null, new EventDispatcher(), $this->factory);

return $formBuilder->getForm();
}

private function getMockFactory(array $methods = [])
{
return $this->getMockBuilder('Symfony\Component\Form\FormFactory')
Expand Down
0