Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 650f6d1

Browse files
committed
feature #20047 [Form] Change FormTypeGuesserChain to accept Traversable (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
2 parents 6a1667d + 5e4f4d4 commit 650f6d1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Symfony/Component/Form/FormTypeGuesserChain.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ class FormTypeGuesserChain implements FormTypeGuesserInterface
2525
*
2626
* @throws UnexpectedTypeException if any guesser does not implement FormTypeGuesserInterface
2727
*/
28-
public function __construct(array $guessers)
28+
public function __construct($guessers)
2929
{
30+
if (!is_array($guessers) && !$guessers instanceof \Traversable) {
31+
throw new UnexpectedTypeException($guessers, 'array or Traversable');
32+
}
33+
3034
foreach ($guessers as $guesser) {
3135
if (!$guesser instanceof FormTypeGuesserInterface) {
3236
throw new UnexpectedTypeException($guesser, 'Symfony\Component\Form\FormTypeGuesserInterface');

0 commit comments

Comments
 (0)