Skip to content

Commit

Permalink
bug #36297 [Form] action allows only strings (maxhelias)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
fabpot committed Apr 4, 2020
2 parents ba52c62 + e861500 commit 5aeecc2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ public function configureOptions(OptionsResolver $resolver)
]);

$resolver->setAllowedTypes('label_attr', 'array');
$resolver->setAllowedTypes('action', 'string');
$resolver->setAllowedTypes('upload_max_size_message', ['callable']);
$resolver->setAllowedTypes('help', ['string', 'null']);
$resolver->setAllowedTypes('help_attr', 'array');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,12 @@ public function testAttributesException()
$this->factory->create(static::TESTED_TYPE, null, ['attr' => '']);
}

public function testActionCannotBeNull()
{
$this->expectException('Symfony\Component\OptionsResolver\Exception\InvalidOptionsException');
$this->factory->create(static::TESTED_TYPE, null, ['action' => null]);
}

public function testNameCanBeEmptyString()
{
$form = $this->factory->createNamed('', static::TESTED_TYPE);
Expand Down

0 comments on commit 5aeecc2

Please sign in to comment.