diff --git a/src/Psl/Collection/MutableSet.php b/src/Psl/Collection/MutableSet.php index 21eda1f6..18a1aa2e 100644 --- a/src/Psl/Collection/MutableSet.php +++ b/src/Psl/Collection/MutableSet.php @@ -76,13 +76,18 @@ public static function fromArray(array $elements): MutableSet * * @template Ts of array-key * - * @param iterable $items + * @param iterable $items * * @return MutableSet */ public static function fromItems(iterable $items): MutableSet { - return self::fromArray(iterator_to_array($items)); + /** + * @psalm-suppress InvalidArgument + * @var array + */ + $array = iterator_to_array($items); + return self::fromArray($array); } /** diff --git a/src/Psl/Collection/MutableVector.php b/src/Psl/Collection/MutableVector.php index 76915ca0..bd550254 100644 --- a/src/Psl/Collection/MutableVector.php +++ b/src/Psl/Collection/MutableVector.php @@ -75,13 +75,18 @@ public static function fromArray(array $elements): MutableVector * * @template Ts * - * @param iterable $items + * @param iterable $items * * @return MutableVector */ public static function fromItems(iterable $items): MutableVector { - return self::fromArray(iterator_to_array($items)); + /** + * @psalm-suppress InvalidArgument + * @var array + */ + $array = iterator_to_array($items); + return self::fromArray($array); } /** diff --git a/src/Psl/Collection/Set.php b/src/Psl/Collection/Set.php index 981b4785..bd93ba82 100644 --- a/src/Psl/Collection/Set.php +++ b/src/Psl/Collection/Set.php @@ -77,15 +77,18 @@ public static function fromArray(array $elements): Set * * @template Ts of array-key * - * @param iterable $items + * @param iterable $items * * @return Set - * - * @pure */ public static function fromItems(iterable $items): Set { - return self::fromArray(iterator_to_array($items)); + /** + * @var array + * @psalm-suppress InvalidArgument + */ + $array = iterator_to_array($items); + return self::fromArray($array); } /** diff --git a/src/Psl/Collection/Vector.php b/src/Psl/Collection/Vector.php index 1f4e9ba7..3a1cf868 100644 --- a/src/Psl/Collection/Vector.php +++ b/src/Psl/Collection/Vector.php @@ -74,13 +74,18 @@ public static function fromArray(array $elements): Vector * * @template Ts * - * @param iterable $items + * @param iterable $items * * @return Vector */ public static function fromItems(iterable $items): Vector { - return self::fromArray(iterator_to_array($items)); + /** + * @psalm-suppress InvalidArgument + * @var array + */ + $array = iterator_to_array($items); + return self::fromArray($array); } /**