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 5bca285711..c70bc3d037 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 @@ class MergeDoctrineCollectionListenerTest extends TestCase $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 @@ class MergeDoctrineCollectionListenerTest extends TestCase */ 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 f36b5fa1a8..00affbf6d8 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 e4ca7bbd94..0efde40849 100644 --- a/src/Symfony/Component/Form/ResolvedFormType.php +++ b/src/Symfony/Component/Form/ResolvedFormType.php @@ -205,7 +205,7 @@ class ResolvedFormType implements ResolvedFormTypeInterface * 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 41e0333b09..7c9aa96a9e 100644 --- a/src/Symfony/Component/Form/Test/TypeTestCase.php +++ b/src/Symfony/Component/Form/Test/TypeTestCase.php @@ -32,7 +32,7 @@ abstract class TypeTestCase extends FormIntegrationTestCase 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 0ea55f9208..235aa3fa98 100644 --- a/src/Symfony/Component/Form/Tests/AbstractFormTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractFormTest.php @@ -55,7 +55,7 @@ abstract class AbstractFormTest extends TestCase /** * @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 6115640242..8c1ccec75c 100644 --- a/src/Symfony/Component/Form/Tests/ButtonTest.php +++ b/src/Symfony/Component/Form/Tests/ButtonTest.php @@ -41,7 +41,7 @@ class ButtonTest extends TestCase $button->submit(''); - $button->setParent($this->getFormBuilder('form')->getForm()); + $button->setParent($this->getFormBuilder()->getForm()); } /** @@ -49,7 +49,7 @@ class ButtonTest extends TestCase */ public function testDisabledIfParentIsDisabled($parentDisabled, $buttonDisabled, $result) { - $form = $this->getFormBuilder('form') + $form = $this->getFormBuilder() ->setDisabled($parentDisabled) ->getForm() ; @@ -80,8 +80,8 @@ class ButtonTest extends TestCase 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 33783d6a04..5bad588884 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 @@ class CsrfValidationListenerTest extends TestCase $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 @@ class CsrfValidationListenerTest extends TestCase $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 ff3e2cb87d..cdbb79ae3e 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 @@ class ResolvedFormTypeTest extends TestCase { 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); - } }