8000 bug #36297 [Form] action allows only strings (maxhelias) · symfony/symfony@5aeecc2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5aeecc2

Browse files
committed
bug #36297 [Form] action allows only strings (maxhelias)
This PR was submitted for the 5.0 branch but it was merged into the 5.1-dev branch instead. Discussion ---------- [Form] action allows only strings | Q | A | ------------- | --- | Branch? | 5.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | ... | License | MIT | Doc PR | ... On updating an old project that had actions to null it's caused me a type-hint error. With that, we can quickly identify where the problem is Commits ------- e861500 [Form] action allows only strings
2 parents ba52c62 + e861500 commit 5aeecc2

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/Symfony/Component/Form/Extension/Core/Type/FormType.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ public function configureOptions(OptionsResolver $resolver)
203203
]);
204204

205205
$resolver->setAllowedTypes('label_attr', 'array');
206+
$resolver->setAllowedTypes('action', 'string');
206207
$resolver->setAllowedTypes('upload_max_size_message', ['callable']);
207208
$resolver->setAllowedTypes('help', ['string', 'null']);
208209
$resolver->setAllowedTypes('help_attr', 'array');

src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,12 @@ public function testAttributesException()
341341
$this->factory->create(static::TESTED_TYPE, null, ['attr' => '']);
342342
}
343343

344+
public function testActionCannotBeNull()
345+
{
346+
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
347+
$this->factory->create(static::TESTED_TYPE, null, ['action' => null]);
348+
}
349+
344350
public function testNameCanBeEmptyString()
345351
{
346352
$form = $this->factory->createNamed('', static::TESTED_TYPE);

0 commit comments

Comments
 (0)
0