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 and joerivanveen committed Mar 14, 2024
1 parent 5aec8f9 commit c21cade
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 c21cade

Please sign in to comment.