The exception should be thrown if an object doesn't implement Traversable AND doesn't implement Countable, not when it doesn't implement Traversable but DOES implement Countable

This commit is contained in:
Robin Kanters 2016-02-16 15:02:44 +01:00 committed by Fabien Potencier
parent a515383611
commit 8eea65e0d8

View File

@ -140,7 +140,7 @@ class Question
}
if (null !== $values && !is_array($values)) {
if (!$values instanceof \Traversable || $values instanceof \Countable) {
if (!$values instanceof \Traversable || !$values instanceof \Countable) {
throw new \InvalidArgumentException('Autocompleter values can be either an array, `null` or an object implementing both `Countable` and `Traversable` interfaces.');
}
}