Skip to content

Commit 5ee954c

Browse files
committed
minor symfony#28789 [Form] fix a return type hint (xabbuh)
This PR was merged into the 4.1 branch. Discussion ---------- [Form] fix a return type hint | Q | A | ------------- | --- | Branch? | 4.1 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#26918 | License | MIT | Doc PR | Commits ------- 095b9f3 fix a return type hint
2 parents 76a0682 + 095b9f3 commit 5ee954c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/Symfony/Component/Form/FormBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,9 @@ public function getIterator()
235235
}
236236

237237
/**
238-
* Converts an unresolved child into a {@link FormBuilder} instance.
238+
* Converts an unresolved child into a {@link FormBuilderInterface} instance.
239239
*/
240-
private function resolveChild(string $name): self
240+
private function resolveChild(string $name): FormBuilderInterface
241241
{
242242
$info = $this->unresolvedChildren[$name];
243243
$child = $this->create($name, $info['type'], $info['options']);

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\Form\ButtonBuilder;
16+
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
1617
use Symfony\Component\Form\FormBuilder;
18+
use Symfony\Component\Form\FormFactoryBuilder;
1719
use Symfony\Component\Form\SubmitButtonBuilder;
1820

1921
class FormBuilderTest extends TestCase
@@ -228,6 +230,14 @@ public function testGetFormConfigErasesReferences()
228230
$this->assertEmpty($unresolvedChildren->getValue($config));
229231
}
230232

233+
public function testGetButtonBuilderBeforeExplicitlyResolvingAllChildren()
234+
{
235+
$builder = new FormBuilder('name', null, $this->dispatcher, (new FormFactoryBuilder())->getFormFactory());
236+
$builder->add('submit', SubmitType::class);
237+
238+
$this->assertInstanceOf(ButtonBuilder::class, $builder->get('submit'));
239+
}
240+
231241
private function getFormBuilder($name = 'name')
232242
{
233243
$mock = $this->getMockBuilder('Symfony\Component\Form\FormBuilder')

0 commit comments

Comments
 (0)