should be ``} elseif (``

And you should check ``\Traversable``, not ``\Iterator``