Skip to content

Commit 8b23489

Browse files
committed
Merge branch 'medeiroz/9.x' into 9.x
2 parents 613b0e2 + c02f33f commit 8b23489

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Illuminate/Collections/Collection.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,11 @@ public function groupBy($groupBy, $preserveKeys = false)
488488
}
489489

490490
foreach ($groupKeys as $groupKey) {
491-
$groupKey = is_bool($groupKey) ? (int) $groupKey : $groupKey;
491+
$groupKey = match (true) {
492+
is_bool($groupKey) => (int) $groupKey,
493+
is_object($groupKey) => (string) $groupKey,
494+
default => $groupKey,
495+
};
492496

493497
if (! array_key_exists($groupKey, $results)) {
494498
$results[$groupKey] = new static;

0 commit comments

Comments
 (0)