Skip to content

Commit

Permalink
array support for merge()
Browse files Browse the repository at this point in the history
  • Loading branch information
valzargaming committed Jan 17, 2025
1 parent 7e69786 commit 39b428d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Discord/Helpers/CollectionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,11 @@ public function unique(int $flags = SORT_STRING)
*/
public function merge($collection): self
{
$this->items = array_merge($this->items, $collection->toArray());
$items = $collection instanceof CollectionInterface
? $collection->toArray()
: $collection;

$this->items = array_merge($this->items, $items);

return $this;
}
Expand Down

0 comments on commit 39b428d

Please sign in to comment.