Skip to content

[Form] Change FormTypeGuesserChain to accept Traversable #20047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 19, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Symfony/Component/Form/FormTypeGuesserChain.php
Original file line number Diff line number Diff line change
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