Skip to content

Commit 0b96d9b

Browse files
authored
cosmetic: include is_array() case in match of getArrayableItems (#55275)
getArrayableItems() already makes excellent use of match(true). I would like to include the is_array check in there to make it more uniform and end up with a single expression.
1 parent 98375d1 commit 0b96d9b

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/Illuminate/Collections/Traits/EnumeratesValues.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -1046,11 +1046,8 @@ public function __get($key)
10461046
*/
10471047
protected function getArrayableItems($items)
10481048
{
1049-
if (is_array($items)) {
1050-
return $items;
1051-
}
1052-
10531049
return match (true) {
1050+
is_array($items) => $items,
10541051
$items instanceof WeakMap => throw new InvalidArgumentException('Collections can not be created using instances of WeakMap.'),
10551052
$items instanceof Enumerable => $items->all(),
10561053
$items instanceof Arrayable => $items->toArray(),

0 commit comments

Comments
 (0)