Skip to content

Commit

Permalink
[11.x] prefer new Collection() over collect() (#53563)
Browse files Browse the repository at this point in the history
* wip

* wip

* minor formatting
  • Loading branch information
browner12 authored Nov 18, 2024
1 parent c09bca7 commit 869a20d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions MessageBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public function get($key, $format = null)
*/
protected function getMessagesForWildcardKey($key, $format)
{
return collect($this->messages)
return (new Collection($this->messages))
->filter(function ($messages, $messageKey) use ($key) {
return Str::is($key, $messageKey);
})
Expand Down Expand Up @@ -291,7 +291,7 @@ protected function transform($messages, $format, $messageKey)
return (array) $messages;
}

return collect((array) $messages)
return (new Collection((array) $messages))
->map(function ($message) use ($format, $messageKey) {
// We will simply spin through the given messages and transform each one
// replacing the :message place holder with the real message allowing
Expand Down

0 comments on commit 869a20d

Please sign in to comment.