Skip to content

Commit

Permalink
fix(collection): allow array in toArray (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Ernst authored Dec 16, 2022
1 parent 7724ae4 commit 73bfd46
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Support/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1712,7 +1712,7 @@ public function toArray(): array
{
return array_map(
static function ($value) {
if ($value && method_exists($value, 'toArray')) {
if ($value && (is_object($value) || is_string($value)) && method_exists($value, 'toArray')) {
return $value->toArray();
}
return $value;
Expand Down

0 comments on commit 73bfd46

Please sign in to comment.