Despite of what @rn0 said I think it should be written as:
```
        if (!is_array($value) && !($value instanceof \Iterator)) {
```
Btw. the case with iterator is not tested in spec.