diff --git a/src/Illuminate/Collections/Collection.php b/src/Illuminate/Collections/Collection.php index 7d2bcdadc180..150ccbe8b749 100644 --- a/src/Illuminate/Collections/Collection.php +++ b/src/Illuminate/Collections/Collection.php @@ -86,7 +86,7 @@ public function lazy() public function median($key = null) { $values = (isset($key) ? $this->pluck($key) : $this) - ->filter(fn ($item) => ! is_null($item)) + ->reject(fn ($item) => is_null($item)) ->sort()->values(); $count = $values->count(); diff --git a/src/Illuminate/Collections/Traits/EnumeratesValues.php b/src/Illuminate/Collections/Traits/EnumeratesValues.php index 010924f67633..10a55498edf2 100644 --- a/src/Illuminate/Collections/Traits/EnumeratesValues.php +++ b/src/Illuminate/Collections/Traits/EnumeratesValues.php @@ -457,7 +457,7 @@ public function min($callback = null) $callback = $this->valueRetriever($callback); return $this->map(fn ($value) => $callback($value)) - ->filter(fn ($value) => ! is_null($value)) + ->reject(fn ($value) => is_null($value)) ->reduce(fn ($result, $value) => is_null($result) || $value < $result ? $value : $result); } @@ -471,7 +471,7 @@ public function max($callback = null) { $callback = $this->valueRetriever($callback); - return $this->filter(fn ($value) => ! is_null($value))->reduce(function ($result, $item) use ($callback) { + return $this->reject(fn ($value) => is_null($value))->reduce(function ($result, $item) use ($callback) { $value = $callback($item); return is_null($result) || $value > $result ? $value : $result; diff --git a/src/Illuminate/Database/Eloquent/Collection.php b/src/Illuminate/Database/Eloquent/Collection.php index 1ae950cb9e73..e4a151275a5f 100755 --- a/src/Illuminate/Database/Eloquent/Collection.php +++ b/src/Illuminate/Database/Eloquent/Collection.php @@ -824,7 +824,7 @@ public function toQuery() $class = get_class($model); - if ($this->filter(fn ($model) => ! $model instanceof $class)->isNotEmpty()) { + if ($this->reject(fn ($model) => $model instanceof $class)->isNotEmpty()) { throw new LogicException('Unable to create query for collection with mixed types.'); } diff --git a/src/Illuminate/Foundation/Testing/DatabaseTruncation.php b/src/Illuminate/Foundation/Testing/DatabaseTruncation.php index 3f2c95cd637e..8e31985e21fb 100644 --- a/src/Illuminate/Foundation/Testing/DatabaseTruncation.php +++ b/src/Illuminate/Foundation/Testing/DatabaseTruncation.php @@ -95,7 +95,7 @@ function (Collection $tables, array $tablesToTruncate) { function (Collection $tables) use ($connection, $name) { $exceptTables = $this->exceptTables($connection, $name); - return $tables->filter(fn (array $table) => ! $this->tableExistsIn($table, $exceptTables)); + return $tables->reject(fn (array $table) => $this->tableExistsIn($table, $exceptTables)); } ) ->each(function (array $table) use ($connection) { diff --git a/src/Illuminate/Foundation/resources/exceptions/renderer/components/trace.blade.php b/src/Illuminate/Foundation/resources/exceptions/renderer/components/trace.blade.php index 1930737be2db..3c0b2ddb6760 100644 --- a/src/Illuminate/Foundation/resources/exceptions/renderer/components/trace.blade.php +++ b/src/Illuminate/Foundation/resources/exceptions/renderer/components/trace.blade.php @@ -69,7 +69,7 @@ class="w-full text-left dark:border-gray-900" - @if (! $frame->isFromVendor() && $exception->frames()->slice($loop->index + 1)->filter(fn ($frame) => ! $frame->isFromVendor())->isEmpty()) + @if (! $frame->isFromVendor() && $exception->frames()->slice($loop->index + 1)->reject(fn ($frame) => $frame->isFromVendor())->isEmpty()) @if ($exception->frames()->slice($loop->index + 1)->count())