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

Skip to content

Commit 5e4f4d4

Browse files
committed
[Form] Change FormTypeGuesserChain to accept Traversable
1 parent b53fe24 commit 5e4f4d4

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)