From 6a99b2370678b2f18318f5099546274e429347cf Mon Sep 17 00:00:00 2001 From: Jacob Dreesen Date: Mon, 24 Apr 2017 20:11:13 +0200 Subject: [PATCH] Use ArrayIterator instead of RecursiveArrayIterator for array input --- src/Collection.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Collection.php b/src/Collection.php index 1bc1818..a6b57e5 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -2,10 +2,10 @@ namespace DusanKasan\Knapsack; +use ArrayIterator; use DusanKasan\Knapsack\Exceptions\InvalidArgument; use DusanKasan\Knapsack\Exceptions\InvalidReturnValue; use IteratorAggregate; -use RecursiveArrayIterator; use Traversable; class Collection implements IteratorAggregate, \Serializable @@ -33,7 +33,7 @@ public function __construct($input) } if (is_array($input)) { - $this->input = new RecursiveArrayIterator($input); + $this->input = new ArrayIterator($input); } elseif ($input instanceof Traversable) { $this->input = $input; } else { @@ -101,7 +101,7 @@ public function getIterator() $input = call_user_func($this->inputFactory); if (is_array($input)) { - $input = new RecursiveArrayIterator($input); + $input = new ArrayIterator($input); } if (!($input instanceof Traversable)) {