Skip to content

Commit 370fbd8

Browse files
committed
fix parameter type declaration and make fabbot happy
1 parent 4b22637 commit 370fbd8

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

FormInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
3131
* @throws Exception\LogicException when trying to set a parent for a form with
3232
* an empty name
3333
*/
34-
public function setParent(FormInterface $parent = null);
34+
public function setParent(self $parent = null);
3535

3636
/**
3737
* Returns the parent form.

Tests/FormFactoryTest.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313

1414
use PHPUnit\Framework\MockObject\MockObject;
1515
use PHPUnit\Framework\TestCase;
16+
use Symfony\Component\EventDispatcher\EventDispatcher;
17+
use Symfony\Component\Form\FormBuilder;
1618
use Symfony\Component\Form\FormFactory;
17-
use Symfony\Component\Form\FormInterface;
1819
use Symfony\Component\Form\FormTypeGuesserChain;
1920
use Symfony\Component\Form\Guess\Guess;
2021
use Symfony\Component\Form\Guess\TypeGuess;
@@ -194,7 +195,7 @@ public function testCreateUsesBlockPrefixIfTypeGivenAsString()
194195
->method('buildForm')
195196
->with($this->builder, $resolvedOptions);
196197

197-
$form = $this->createMock(FormInterface::class);
198+
$form = $this->createForm();
198199

199200
$this->builder->expects($this->once())
200201
->method('getForm')
@@ -227,7 +228,7 @@ public function testCreateNamed()
227228
->method('buildForm')
228229
->with($this->builder, $resolvedOptions);
229230

230-
$form = $this->createMock(FormInterface::class);
231+
$form = $this->createForm();
231232

232233
$this->builder->expects($this->once())
233234
->method('getForm')
@@ -467,6 +468,13 @@ public function testCreateBuilderUsesPatternIfFound()
467468
$this->assertSame($this->builder, $this->builder);
468469
}
469470

471+
protected function createForm()
472+
{
473+
$formBuilder = new FormBuilder('', null, new EventDispatcher(), $this->factory);
474+
475+
return $formBuilder->getForm();
476+
}
477+
470478
private function getMockFactory(array $methods = [])
471479
{
472480
return $this->getMockBuilder('Symfony\Component\Form\FormFactory')

0 commit comments

Comments
 (0)