diff --git a/src/Option/From.php b/src/Option/From.php index 8fbb6e3..1f21ba8 100644 --- a/src/Option/From.php +++ b/src/Option/From.php @@ -10,6 +10,7 @@ namespace Prewk\Option; +use Traversable; use Prewk\Option; /** @@ -59,7 +60,7 @@ public static function emptyable($thing): Option */ public static function first($iterable): Option { - if (!is_iterable($iterable)) { + if (!is_array($iterable) && !($iterable instanceof Traversable)) { throw new OptionException("Couldn't create Option from first item in non-iterable"); }