8000 [Form] Change FormTypeGuesserChain to accept Traversable · symfony/symfony@4363af2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4363af2

Browse files
committed
[Form] Change FormTypeGuesserChain to accept Traversable
1 parent b53fe24 commit 4363af2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Symfony/Component/Form/FormTypeGuesserChain.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ 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) {
32-
throw new UnexpectedTypeException($guesser, 'Symfony\Component\Form\FormTypeGuesserInterface');
36+
throw new UnexpectedTypeException($guesser, FormTypeGuesserInterface::class);
3337
}
3438

3539
if ($guesser instanceof self) {

0 commit comments

Comments
 (0)
0