diff --git a/src/ResolveIteratorCapableTrait.php b/src/ResolveIteratorCapableTrait.php
index <HASH>..<HASH> 100644
--- a/src/ResolveIteratorCapableTrait.php
+++ b/src/ResolveIteratorCapableTrait.php
@@ -59,7 +59,10 @@ trait ResolveIteratorCapableTrait
 
         $i = 0;
         while (!$test($iterator) && $i < $limit) {
-            /* @var $iterator IteratorAggregate */
+            if (!($iterator instanceof IteratorAggregate)) {
+                break;
+            }
+
             $_it = $iterator->getIterator();
             if ($iterator === $_it) {
                 throw $this->_createOutOfRangeException(
Added test for `IteratorAggregate`

This is because the test function is not guaranteed to test for
`Iterator` interface.