From 19b292893aaa404330884f9c726a47324a9dca80 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 26 Aug 2019 21:59:46 +0200 Subject: [PATCH] fix parameter type declaration and make fabbot happy --- src/Symfony/Component/Form/FormInterface.php | 2 +- .../Component/Form/Tests/FormFactoryTest.php | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Form/FormInterface.php b/src/Symfony/Component/Form/FormInterface.php index f8d5c6ea5b..5c55bcd795 100644 --- a/src/Symfony/Component/Form/FormInterface.php +++ b/src/Symfony/Component/Form/FormInterface.php @@ -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. diff --git a/src/Symfony/Component/Form/Tests/FormFactoryTest.php b/src/Symfony/Component/Form/Tests/FormFactoryTest.php index 79421be635..7a978b1dfd 100644 --- a/src/Symfony/Component/Form/Tests/FormFactoryTest.php +++ b/src/Symfony/Component/Form/Tests/FormFactoryTest.php @@ -13,8 +13,9 @@ namespace Symfony\Component\Form\Tests; 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; @@ -194,7 +195,7 @@ class FormFactoryTest extends TestCase ->method('buildForm') ->with($this->builder, $resolvedOptions); - $form = $this->createMock(FormInterface::class); + $form = $this->createForm(); $this->builder->expects($this->once()) ->method('getForm') @@ -227,7 +228,7 @@ class FormFactoryTest extends TestCase ->method('buildForm') ->with($this->builder, $resolvedOptions); - $form = $this->createMock(FormInterface::class); + $form = $this->createForm(); $this->builder->expects($this->once()) ->method('getForm') @@ -467,6 +468,13 @@ class FormFactoryTest extends TestCase $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')