From af5218593a45865e11080b55c986a7a685fa8bbb Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 10 Oct 2021 07:59:31 +0000 Subject: update composer libs --- vendor/ramsey/collection/src/AbstractCollection.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'vendor/ramsey/collection/src/AbstractCollection.php') diff --git a/vendor/ramsey/collection/src/AbstractCollection.php b/vendor/ramsey/collection/src/AbstractCollection.php index b1df91923..d2cd1151c 100644 --- a/vendor/ramsey/collection/src/AbstractCollection.php +++ b/vendor/ramsey/collection/src/AbstractCollection.php @@ -32,6 +32,7 @@ use function array_uintersect; use function current; use function end; use function in_array; +use function is_int; use function reset; use function sprintf; use function unserialize; @@ -238,7 +239,7 @@ abstract class AbstractCollection extends AbstractArray implements CollectionInt public function merge(CollectionInterface ...$collections): CollectionInterface { - $temp = [$this->data]; + $mergedCollection = clone $this; foreach ($collections as $index => $collection) { if (!$collection instanceof static) { @@ -255,15 +256,16 @@ abstract class AbstractCollection extends AbstractArray implements CollectionInt ); } - $temp[] = $collection->toArray(); + foreach ($collection as $key => $value) { + if (is_int($key)) { + $mergedCollection[] = $value; + } else { + $mergedCollection[$key] = $value; + } + } } - $merge = array_merge(...$temp); - - $collection = clone $this; - $collection->data = $merge; - - return $collection; + return $mergedCollection; } /** -- cgit v1.2.3