diff options
author | Mario <mario@mariovavti.com> | 2021-10-10 07:59:31 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-10-10 07:59:31 +0000 |
commit | af5218593a45865e11080b55c986a7a685fa8bbb (patch) | |
tree | c529635dd90249bba0cd641cf527404e908291c7 /vendor/ramsey/collection/src/AbstractCollection.php | |
parent | f19acd9f50ec9b8c78f77af64d523d2295b46052 (diff) | |
download | volse-hubzilla-af5218593a45865e11080b55c986a7a685fa8bbb.tar.gz volse-hubzilla-af5218593a45865e11080b55c986a7a685fa8bbb.tar.bz2 volse-hubzilla-af5218593a45865e11080b55c986a7a685fa8bbb.zip |
update composer libs
Diffstat (limited to 'vendor/ramsey/collection/src/AbstractCollection.php')
-rw-r--r-- | vendor/ramsey/collection/src/AbstractCollection.php | 18 |
1 files changed, 10 insertions, 8 deletions
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; } /** |