Skip to content

Commit cbecfc3

Browse files
committed
minor symfony#21233 [Form] Removed unused ResolvedTypeFactory in FormFactory constructor (HeahDude)
This PR was merged into the 3.3-dev branch. Discussion ---------- [Form] Removed unused ResolvedTypeFactory in FormFactory constructor | Q | A | ------------- | --- | Branch? | 3.1 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | ~ ____ This PR just removes some legacy code from 2.x. Commits ------- 3607eb3 [Form] Removed unused ResolvedTypeFactory in FormFactory constructor
2 parents 8b35478 + 3607eb3 commit cbecfc3

File tree

3 files changed

+6
-22
lines changed

3 files changed

+6
-22
lines changed

src/Symfony/Component/Form/FormFactory.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,11 @@
1515

1616
class FormFactory implements FormFactoryInterface
1717
{
18-
/**
19-
* @var FormRegistryInterface
20-
*/
2118
private $registry;
2219

23-
/**
24-
* @var ResolvedFormTypeFactoryInterface
25-
*/
26-
private $resolvedTypeFactory;
27-
28-
public function __construct(FormRegistryInterface $registry, ResolvedFormTypeFactoryInterface $resolvedTypeFactory)
20+
public function __construct(FormRegistryInterface $registry)
2921
{
3022
$this->registry = $registry;
31-
$this->resolvedTypeFactory = $resolvedTypeFactory;
3223
}
3324

3425
/**

src/Symfony/Component/Form/FormFactoryBuilder.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,8 @@ public function getFormFactory()
154154
$extensions[] = new PreloadedExtension($this->types, $this->typeExtensions, $typeGuesser);
155155
}
156156

157-
$resolvedTypeFactory = $this->resolvedTypeFactory ?: new ResolvedFormTypeFactory();
158-
$registry = new FormRegistry($extensions, $resolvedTypeFactory);
157+
$registry = new FormRegistry($extensions, $this->resolvedTypeFactory ?: new ResolvedFormTypeFactory());
159158

160-
return new FormFactory($registry, $resolvedTypeFactory);
159+
return new FormFactory($registry);
161160
}
162161
}

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
3737
*/
3838
private $registry;
3939

40-
/**
41-
* @var \PHPUnit_Framework_MockObject_MockObject
42-
*/
43-
private $resolvedTypeFactory;
44-
4540
/**
4641
* @var \PHPUnit_Framework_MockObject_MockObject
4742
*/
@@ -54,12 +49,11 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
5449

5550
protected function setUp()
5651
{
57-
$this->resolvedTypeFactory = $this->getMockBuilder('Symfony\Component\Form\ResolvedFormTypeFactoryInterface')->getMock();
5852
$this->guesser1 = $this->getMockBuilder('Symfony\Component\Form\FormTypeGuesserInterface')->getMock();
5953
$this->guesser2 = $this->getMockBuilder('Symfony\Component\Form\FormTypeGuesserInterface')->getMock();
6054
$this->registry = $this->getMockBuilder('Symfony\Component\Form\FormRegistryInterface')->getMock();
6155
$this->builder = $this->getMockBuilder('Symfony\Component\Form\Test\FormBuilderInterface')->getMock();
62-
$this->factory = new FormFactory($this->registry, $this->resolvedTypeFactory);
56+
$this->factory = new FormFactory($this->registry);
6357

6458
$this->registry->expects($this->any())
6559
->method('getTypeGuesser')
@@ -244,7 +238,7 @@ public function testCreateBuilderForPropertyWithoutTypeGuesser()
244238
$registry = $this->getMockBuilder('Symfony\Component\Form\FormRegistryInterface')->getMock();
245239
$factory = $this->getMockBuilder('Symfony\Component\Form\FormFactory')
246240
->setMethods(array('createNamedBuilder'))
247-
->setConstructorArgs(array($registry, $this->resolvedTypeFactory))
241+
->setConstructorArgs(array($registry))
248242
->getMock();
249243

250244
$factory->expects($this->once())
@@ -474,7 +468,7 @@ private function getMockFactory(array $methods = array())
474468
{
475469
return $this->getMockBuilder('Symfony\Component\Form\FormFactory')
476470
->setMethods($methods)
477-
->setConstructorArgs(array($this->registry, $this->resolvedTypeFactory))
471+
->setConstructorArgs(array($this->registry))
478472
->getMock();
479473
}
480474

0 commit comments

Comments
 (0)