diff --git a/src/Illuminate/Foundation/Console/AboutCommand.php b/src/Illuminate/Foundation/Console/AboutCommand.php index 26fa04446df9..77de686f958f 100644 --- a/src/Illuminate/Foundation/Console/AboutCommand.php +++ b/src/Illuminate/Foundation/Console/AboutCommand.php @@ -230,7 +230,7 @@ protected function gatherApplicationInformation() */ protected function determineStoragePathLinkStatus(callable $formatStorageLinkedStatus): array { - return collect(config('filesystems.links', [])) + return (new Collection(config('filesystems.links', []))) ->mapWithKeys(function ($target, $link) use ($formatStorageLinkedStatus) { $path = Str::replace(public_path(), '', $link); diff --git a/src/Illuminate/Http/Request.php b/src/Illuminate/Http/Request.php index 8695535899e8..995ed0865741 100644 --- a/src/Illuminate/Http/Request.php +++ b/src/Illuminate/Http/Request.php @@ -363,7 +363,7 @@ public function merge(array $input) { return tap($this, function (Request $request) use ($input) { $request->getInputSource() - ->replace(collect($input)->reduce( + ->replace((new Collection($input))->reduce( fn ($requestInput, $value, $key) => data_set($requestInput, $key, $value), $this->getInputSource()->all() )); diff --git a/src/Illuminate/Testing/TestResponse.php b/src/Illuminate/Testing/TestResponse.php index ea4d3793148d..9ad041a160db 100644 --- a/src/Illuminate/Testing/TestResponse.php +++ b/src/Illuminate/Testing/TestResponse.php @@ -989,11 +989,16 @@ public function assertOnlyJsonValidationErrors($errors, $responseKey = 'errors') $jsonErrors = Arr::get($this->json(), $responseKey) ?? []; - $expectedErrorKeys = collect($errors)->map(fn ($value, $key) => is_int($key) ? $value : $key)->all(); + $expectedErrorKeys = (new Collection($errors)) + ->map(fn ($value, $key) => is_int($key) ? $value : $key) + ->all(); $unexpectedErrorKeys = Arr::except($jsonErrors, $expectedErrorKeys); - PHPUnit::withResponse($this)->assertTrue(count($unexpectedErrorKeys) === 0, 'Response has unexpected validation errors: '.collect($unexpectedErrorKeys)->keys()->map(fn ($key) => "'{$key}'")->join(', ')); + PHPUnit::withResponse($this)->assertTrue( + count($unexpectedErrorKeys) === 0, + 'Response has unexpected validation errors: '.(new Collection($unexpectedErrorKeys))->keys()->map(fn ($key) => "'{$key}'")->join(', ') + ); return $this; } @@ -1398,14 +1403,15 @@ public function assertOnlyInvalid($errors = null, $errorBag = 'default', $respon ->getBag($errorBag) ->getMessages(); - $expectedErrorKeys = collect($errors) - ->map(fn ($value, $key) => is_int($key) ? $value : $key)->all(); + $expectedErrorKeys = (new Collection($errors)) + ->map(fn ($value, $key) => is_int($key) ? $value : $key) + ->all(); $unexpectedErrorKeys = Arr::except($sessionErrors, $expectedErrorKeys); PHPUnit::withResponse($this)->assertTrue( count($unexpectedErrorKeys) === 0, - 'Response has unexpected validation errors: '.collect($unexpectedErrorKeys)->keys()->map(fn ($key) => "'{$key}'")->join(', ') + 'Response has unexpected validation errors: '.(new Collection($unexpectedErrorKeys))->keys()->map(fn ($key) => "'{$key}'")->join(', ') ); return $this;