Skip to content

Commit

Permalink
feature #20047 [Form] Change FormTypeGuesserChain to accept Traversab…
Browse files Browse the repository at this point in the history
…le (enumag)

This PR was merged into the 3.2-dev branch.

Discussion
----------

[Form] Change FormTypeGuesserChain to accept Traversable

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

I'm using symfony/form without the rest of the framework and this will make things a bit easier for me.

Commits
-------

5e4f4d4 [Form] Change FormTypeGuesserChain to accept Traversable
  • Loading branch information
fabpot committed Oct 19, 2016
2 parents 6a1667d + 5e4f4d4 commit 650f6d1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Symfony/Component/Form/FormTypeGuesserChain.php
Expand Up @@ -25,8 +25,12 @@ class FormTypeGuesserChain implements FormTypeGuesserInterface
*
* @throws UnexpectedTypeException if any guesser does not implement FormTypeGuesserInterface
*/
public function __construct(array $guessers)
public function __construct($guessers)
{
if (!is_array($guessers) && !$guessers instanceof \Traversable) {
throw new UnexpectedTypeException($guessers, 'array or Traversable');
}

foreach ($guessers as $guesser) {
if (!$guesser instanceof FormTypeGuesserInterface) {
throw new UnexpectedTypeException($guesser, 'Symfony\Component\Form\FormTypeGuesserInterface');
Expand Down

0 comments on commit 650f6d1

Please sign in to comment.