8000 minor #29954 [Form] synchronise the form builder docblock (xabbuh) · symfony/symfony@0c32302 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0c32302

Browse files
committed
minor #29954 [Form] synchronise the form builder docblock (xabbuh)
This PR was merged into the 3.4 branch. Discussion ---------- [Form] synchronise the form builder docblock | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- 419d3db synchronise the form builder docblock
2 parents d760c27 + 419d3db commit 0c32302

File tree

8 files changed

+16
-33
lines changed

8 files changed

+16
-33
lines changed

src/Symfony/Bridge/Doctrine/Tests/Form/EventListener/MergeDoctrineCollectionListenerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ protected function tearDown()
4545
$this->form = null;
4646
}
4747

48-
protected function getBuilder($name = 'name')
48+
protected function getBuilder()
4949
{
50-
return new FormBuilder($name, null, $this->dispatcher, $this->factory);
50+
return new FormBuilder('name', null, $this->dispatcher, $this->factory);
5151
}
5252

53-
protected function getForm($name = 'name')
53+
protected function getForm()
5454
{
55-
return $this->getBuilder($name)
55+
return $this->getBuilder()
5656
->setData($this->collection)
5757
->addEventSubscriber(new MergeDoctrineCollectionListener())
5858
->getForm();
@@ -84,7 +84,7 @@ public function testOnSubmitNullClearCollection()
8484
*/
8585
public function testLegacyChildClassOnSubmitCallParent()
8686
{
87-
$form = $this->getBuilder('name')
87+
$form = $this->getBuilder()
8888
->setData($this->collection)
8989
->addEventSubscriber(new TestClassExtendingMergeDoctrineCollectionListener())
9090
->getForm();

src/Symfony/Component/Form/FormBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
4141
* Creates a new form builder.
4242
*
4343
* @param string $name
44-
* @param string $dataClass
44+
* @param string|null $dataClass
4545
* @param EventDispatcherInterface $dispatcher
4646
* @param FormFactoryInterface $factory
4747
* @param array $options

src/Symfony/Component/Form/ResolvedFormType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function getOptionsResolver()
205205
* Override this method if you want to customize the builder class.
206206
*
207207
* @param string $name The name of the builder
208-
* @param string $dataClass The data class
< ED4F code>208+
* @param string|null $dataClass The data class
209209
* @param FormFactoryInterface $factory The current form factory
210210
* @param array $options The builder options
211211
*

src/Symfony/Component/Form/Test/TypeTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function setUp()
3232
parent::setUp();
3333

3434
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
35-
$this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory);
35+
$this->builder = new FormBuilder('', null, $this->dispatcher, $this->factory);
3636
}
3737

3838
protected function tearDown()

src/Symfony/Component/Form/Tests/AbstractFormTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ abstract protected function createForm();
5555
/**
5656
* @param string $name
5757
* @param EventDispatcherInterface $dispatcher
58-
* @param string $dataClass
58+
* @param string|null $dataClass
5959
* @param array $options
6060
*
6161
* @return FormBuilder

src/Symfony/Component/Form/Tests/ButtonTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ public function testSetParentOnSubmittedButton()
4141

4242
$button->submit('');
4343

44-
$button->setParent($this->getFormBuilder('form')->getForm());
44+
$button->setParent($this->getFormBuilder()->getForm());
4545
}
4646

4747
/**
4848
* @dataProvider getDisabledStates
4949
*/
5050
public function testDisabledIfParentIsDisabled($parentDisabled, $buttonDisabled, $result)
5151
{
52-
$form = $this->getFormBuilder('form')
52+
$form = $this->getFormBuilder()
5353
->setDisabled($parentDisabled)
5454
->getForm()
5555
;
@@ -80,8 +80,8 @@ private function getButtonBuilder($name)
8080
return new ButtonBuilder($name);
8181
}
8282

83-
private function getFormBuilder($name)
83+
private function getFormBuilder()
8484
{
85-
return new FormBuilder($name, null, $this->dispatcher, $this->factory);
85+
return new FormBuilder('form', null, $this->dispatcher, $this->factory);
8686
}
8787
}

src/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ protected function setUp()
2828
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
2929
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
3030
$this->tokenManager = $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock();
31-
$this->form = $this->getBuilder('post')
31+
$this->form = $this->getBuilder()
3232
->setDataMapper($this->getDataMapper())
3333
->getForm();
3434
}
@@ -41,14 +41,9 @@ protected function tearDown()
4141
$this->form = null;
4242
}
4343

44-
protected function getBuilder($name = 'name')
44+
protected function getBuilder()
4545
{
46-
return new FormBuilder($name, null, $this->dispatcher, $this->factory, ['compound' => true]);
47-
}
48-
49-
protected function getForm($name = 'name')
50-
{
51-
return $this->getBuilder($name)->getForm();
46+
return new FormBuilder('post', null, $this->dispatcher, $this->factory, ['compound' => true]);
5247
}
5348

5449
protected function getDataMapper()

src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Form\Tests;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Component\Form\FormBuilder;
1615
use Symfony\Component\Form\FormTypeExtensionInterface;
1716
use Symfony\Component\Form\FormTypeInterface;
1817
use Symfony\Component\Form\ResolvedFormType;
@@ -380,15 +379,4 @@ private function getMockFormFactory()
380379
{
381380
return $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
382381
}
383-
384-
/**
385-
* @param string $name
386-
* @param array $options
387-
*
388-
* @return FormBuilder
389-
*/
390-
protected function getBuilder($name = 'name', array $options = [])
391-
{
392-
return new FormBuilder($name, null, $this->dispatcher, $this->factory, $options);
393-
}
394382
}

0 commit comments

Comments
 (0)
0