From 419d3db86c86475c4d5a231b5208850422cae648 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 22 Jan 2019 15:03:06 +0100 Subject: [PATCH] synchronise the form builder docblock --- .../MergeDoctrineCollectionListenerTest.php | 10 +++++----- src/Symfony/Component/Form/FormBuilder.php | 2 +- src/Symfony/Component/Form/ResolvedFormType.php | 2 +- src/Symfony/Component/Form/Test/TypeTestCase.php | 2 +- .../Component/Form/Tests/AbstractFormTest.php | 2 +- src/Symfony/Component/Form/Tests/ButtonTest.php | 8 ++++---- .../EventListener/CsrfValidationListenerTest.php | 11 +++-------- .../Component/Form/Tests/ResolvedFormTypeTest.php | 12 ------------ 8 files changed, 16 insertions(+), 33 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php index 5bca28571165..c70bc3d0372a 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php @@ -45,14 +45,14 @@ protected function tearDown() $this->form = null; } - protected function getBuilder($name = 'name') + protected function getBuilder() { - return new FormBuilder($name, null, $this->dispatcher, $this->factory); + return new FormBuilder('name', null, $this->dispatcher, $this->factory); } - protected function getForm($name = 'name') + protected function getForm() { - return $this->getBuilder($name) + return $this->getBuilder() ->setData($this->collection) ->addEventSubscriber(new MergeDoctrineCollectionListener()) ->getForm(); @@ -84,7 +84,7 @@ public function testOnSubmitNullClearCollection() */ public function testLegacyChildClassOnSubmitCallParent() { - $form = $this->getBuilder('name') + $form = $this->getBuilder() ->setData($this->collection) ->addEventSubscriber(new TestClassExtendingMergeDoctrineCollectionListener()) ->getForm(); diff --git a/src/Symfony/Component/Form/FormBuilder.php b/src/Symfony/Component/Form/FormBuilder.php index f36b5fa1a83d..00affbf6d8c3 100644 --- a/src/Symfony/Component/Form/FormBuilder.php +++ b/src/Symfony/Component/Form/FormBuilder.php @@ -41,7 +41,7 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB * Creates a new form builder. * * @param string $name - * @param string $dataClass + * @param string|null $dataClass * @param EventDispatcherInterface $dispatcher * @param FormFactoryInterface $factory * @param array $options diff --git a/src/Symfony/Component/Form/ResolvedFormType.php b/src/Symfony/Component/Form/ResolvedFormType.php index e4ca7bbd94dd..0efde40849f0 100644 --- a/src/Symfony/Component/Form/ResolvedFormType.php +++ b/src/Symfony/Component/Form/ResolvedFormType.php @@ -205,7 +205,7 @@ public function getOptionsResolver() * Override this method if you want to customize the builder class. * * @param string $name The name of the builder - * @param string $dataClass The data class + * @param string|null $dataClass The data class * @param FormFactoryInterface $factory The current form factory * @param array $options The builder options * diff --git a/src/Symfony/Component/Form/Test/TypeTestCase.php b/src/Symfony/Component/Form/Test/TypeTestCase.php index 41e0333b0954..7c9aa96a9eae 100644 --- a/src/Symfony/Component/Form/Test/TypeTestCase.php +++ b/src/Symfony/Component/Form/Test/TypeTestCase.php @@ -32,7 +32,7 @@ protected function setUp() parent::setUp(); $this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock(); - $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory); + $this->builder = new FormBuilder('', null, $this->dispatcher, $this->factory); } protected function tearDown() diff --git a/src/Symfony/Component/Form/Tests/AbstractFormTest.php b/src/Symfony/Component/Form/Tests/AbstractFormTest.php index 0ea55f9208b1..235aa3fa98d0 100644 --- a/src/Symfony/Component/Form/Tests/AbstractFormTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractFormTest.php @@ -55,7 +55,7 @@ abstract protected function createForm(); /** * @param string $name * @param EventDispatcherInterface $dispatcher - * @param string $dataClass + * @param string|null $dataClass * @param array $options * * @return FormBuilder diff --git a/src/Symfony/Component/Form/Tests/ButtonTest.php b/src/Symfony/Component/Form/Tests/ButtonTest.php index 6115640242bc..8c1ccec75c2b 100644 --- a/src/Symfony/Component/Form/Tests/ButtonTest.php +++ b/src/Symfony/Component/Form/Tests/ButtonTest.php @@ -41,7 +41,7 @@ public function testSetParentOnSubmittedButton() $button->submit(''); - $button->setParent($this->getFormBuilder('form')->getForm()); + $button->setParent($this->getFormBuilder()->getForm()); } /** @@ -49,7 +49,7 @@ public function testSetParentOnSubmittedButton() */ public function testDisabledIfParentIsDisabled($parentDisabled, $buttonDisabled, $result) { - $form = $this->getFormBuilder('form') + $form = $this->getFormBuilder() ->setDisabled($parentDisabled) ->getForm() ; @@ -80,8 +80,8 @@ private function getButtonBuilder($name) return new ButtonBuilder($name); } - private function getFormBuilder($name) + private function getFormBuilder() { - return new FormBuilder($name, null, $this->dispatcher, $this->factory); + return new FormBuilder('form', null, $this->dispatcher, $this->factory); } } diff --git a/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php b/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php index 33783d6a043a..5bad58888406 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php @@ -28,7 +28,7 @@ protected function setUp() $this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock(); $this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock(); $this->tokenManager = $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock(); - $this->form = $this->getBuilder('post') + $this->form = $this->getBuilder() ->setDataMapper($this->getDataMapper()) ->getForm(); } @@ -41,14 +41,9 @@ protected function tearDown() $this->form = null; } - protected function getBuilder($name = 'name') + protected function getBuilder() { - return new FormBuilder($name, null, $this->dispatcher, $this->factory, ['compound' => true]); - } - - protected function getForm($name = 'name') - { - return $this->getBuilder($name)->getForm(); + return new FormBuilder('post', null, $this->dispatcher, $this->factory, ['compound' => true]); } protected function getDataMapper() diff --git a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php index ff3e2cb87de8..cdbb79ae3e0f 100644 --- a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php +++ b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Form\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Component\Form\FormBuilder; use Symfony\Component\Form\FormTypeExtensionInterface; use Symfony\Component\Form\FormTypeInterface; use Symfony\Component\Form\ResolvedFormType; @@ -380,15 +379,4 @@ private function getMockFormFactory() { return $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock(); } - - /** - * @param string $name - * @param array $options - * - * @return FormBuilder - */ - protected function getBuilder($name = 'name', array $options = []) - { - return new FormBuilder($name, null, $this->dispatcher, $this->factory, $options); - } }