From 9db06cef9311606b1e560228de3e86ad4c77d8e2 Mon Sep 17 00:00:00 2001 From: Lucas Michot Date: Sat, 14 Dec 2024 11:13:46 +0100 Subject: [PATCH] [11.x] Collection::range --- src/Illuminate/Pagination/AbstractPaginator.php | 2 +- src/Illuminate/Support/Benchmark.php | 2 +- src/Illuminate/Testing/Concerns/RunsInParallel.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Pagination/AbstractPaginator.php b/src/Illuminate/Pagination/AbstractPaginator.php index 4893396279a7..58113ed6db92 100644 --- a/src/Illuminate/Pagination/AbstractPaginator.php +++ b/src/Illuminate/Pagination/AbstractPaginator.php @@ -159,7 +159,7 @@ public function previousPageUrl() */ public function getUrlRange($start, $end) { - return (new Collection(range($start, $end))) + return Collection::range($start, $end) ->mapWithKeys(fn ($page) => [$page => $this->url($page)]) ->all(); } diff --git a/src/Illuminate/Support/Benchmark.php b/src/Illuminate/Support/Benchmark.php index 7ea874937706..87734824ad53 100644 --- a/src/Illuminate/Support/Benchmark.php +++ b/src/Illuminate/Support/Benchmark.php @@ -16,7 +16,7 @@ class Benchmark public static function measure(Closure|array $benchmarkables, int $iterations = 1): array|float { return Collection::wrap($benchmarkables)->map(function ($callback) use ($iterations) { - return (new Collection(range(1, $iterations)))->map(function () use ($callback) { + return Collection::range(1, $iterations)->map(function () use ($callback) { gc_collect_cycles(); $start = hrtime(true); diff --git a/src/Illuminate/Testing/Concerns/RunsInParallel.php b/src/Illuminate/Testing/Concerns/RunsInParallel.php index 740ca8d36c89..18380e588ab1 100644 --- a/src/Illuminate/Testing/Concerns/RunsInParallel.php +++ b/src/Illuminate/Testing/Concerns/RunsInParallel.php @@ -147,7 +147,7 @@ protected function forEachProcess($callback) ? $this->options->processes : $this->options->processes(); - (new Collection(range(1, $processes)))->each(function ($token) use ($callback) { + Collection::range(1, $processes)->each(function ($token) use ($callback) { tap($this->createApplication(), function ($app) use ($callback, $token) { ParallelTesting::resolveTokenUsing(fn () => $token);