Skip to content

Commit 415e15a

Browse files
committed
Fix LogFileCollection sorting to use idiomatic Laravel .all() method
Replace .toArray() with .all() in sortByEarliestFirst() and sortByLatestFirst() to preserve Collection type consistency and maintain idiomatic Laravel patterns.
1 parent 2140b51 commit 415e15a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/LogFileCollection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function sortByEarliestFirst(): self
1414
{
1515
$this->items = $this->sortBy(function (LogFile $file) {
1616
return $file->earliestTimestamp().($file->name ?? '');
17-
}, SORT_NATURAL)->values()->toArray();
17+
}, SORT_NATURAL)->values()->all();
1818

1919
return $this;
2020
}
@@ -23,7 +23,7 @@ public function sortByLatestFirst(): self
2323
{
2424
$this->items = $this->sortByDesc(function (LogFile $file) {
2525
return $file->latestTimestamp().($file->name ?? '');
26-
}, SORT_NATURAL)->values()->toArray();
26+
}, SORT_NATURAL)->values()->all();
2727

2828
return $this;
2929
}

0 commit comments

Comments
 (0)