Skip to content

Commit

Permalink
minor #29954 [Form] synchronise the form builder docblock (xabbuh)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
fabpot committed Jan 23, 2019
2 parents d760c27 + 419d3db commit 0c32302
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -84,7 +84,7 @@ public function testOnSubmitNullClearCollection()
*/
public function testLegacyChildClassOnSubmitCallParent()
{
$form = $this->getBuilder('name')
$form = $this->getBuilder()
->setData($this->collection)
->addEventSubscriber(new TestClassExtendingMergeDoctrineCollectionListener())
->getForm();
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/FormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/ResolvedFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/Test/TypeTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/Tests/AbstractFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Component/Form/Tests/ButtonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ public function testSetParentOnSubmittedButton()

$button->submit('');

$button->setParent($this->getFormBuilder('form')->getForm());
$button->setParent($this->getFormBuilder()->getForm());
}

/**
* @dataProvider getDisabledStates
*/
public function testDisabledIfParentIsDisabled($parentDisabled, $buttonDisabled, $result)
{
$form = $this->getFormBuilder('form')
$form = $this->getFormBuilder()
->setDisabled($parentDisabled)
->getForm()
;
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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()
Expand Down
12 changes: 0 additions & 12 deletions src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}

0 comments on commit 0c32302

Please sign in to comment.