From d4d961392fcd836de1e2fb1ca2ca1d7c242bb4e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=A1=E5=AE=85=E7=94=B7=28YznCMS=E5=AE=98=E6=96=B9=29?= <530765310@qq.com> Date: Fri, 13 Dec 2024 13:42:20 +0800 Subject: [PATCH] Update Enumerable.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 兼容php8.4 --- src/Collect/Support/Enumerable.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Collect/Support/Enumerable.php b/src/Collect/Support/Enumerable.php index 942d82e..f423705 100644 --- a/src/Collect/Support/Enumerable.php +++ b/src/Collect/Support/Enumerable.php @@ -37,7 +37,7 @@ public static function make($items = []); * @param callable|null $callback * @return static */ - public static function times($number, callable $callback = null); + public static function times($number, ?callable $callback = null); /** * Create a collection with the given range. @@ -295,7 +295,7 @@ public function except($keys); * @param (callable(TValue): bool)|null $callback * @return static */ - public function filter(callable $callback = null); + public function filter(?callable $callback = null); /** * Apply the callback if the given "value" is (or resolves to) truthy. @@ -307,7 +307,7 @@ public function filter(callable $callback = null); * @param (callable($this): TWhenReturnType)|null $default * @return $this|TWhenReturnType */ - public function when($value, callable $callback = null, callable $default = null); + public function when($value, ?callable $callback = null, ?callable $default = null); /** * Apply the callback if the collection is empty. @@ -318,7 +318,7 @@ public function when($value, callable $callback = null, callable $default = null * @param (callable($this): TWhenEmptyReturnType)|null $default * @return $this|TWhenEmptyReturnType */ - public function whenEmpty(callable $callback, callable $default = null); + public function whenEmpty(callable $callback, ?callable $default = null); /** * Apply the callback if the collection is not empty. @@ -329,7 +329,7 @@ public function whenEmpty(callable $callback, callable $default = null); * @param (callable($this): TWhenNotEmptyReturnType)|null $default * @return $this|TWhenNotEmptyReturnType */ - public function whenNotEmpty(callable $callback, callable $default = null); + public function whenNotEmpty(callable $callback, ?callable $default = null); /** * Apply the callback if the given "value" is (or resolves to) truthy. @@ -341,7 +341,7 @@ public function whenNotEmpty(callable $callback, callable $default = null); * @param (callable($this): TUnlessReturnType)|null $default * @return $this|TUnlessReturnType */ - public function unless($value, callable $callback, callable $default = null); + public function unless($value, callable $callback, ?callable $default = null); /** * Apply the callback unless the collection is empty. @@ -352,7 +352,7 @@ public function unless($value, callable $callback, callable $default = null); * @param (callable($this): TUnlessEmptyReturnType)|null $default * @return $this|TUnlessEmptyReturnType */ - public function unlessEmpty(callable $callback, callable $default = null); + public function unlessEmpty(callable $callback, ?callable $default = null); /** * Apply the callback unless the collection is not empty. @@ -363,7 +363,7 @@ public function unlessEmpty(callable $callback, callable $default = null); * @param (callable($this): TUnlessNotEmptyReturnType)|null $default * @return $this|TUnlessNotEmptyReturnType */ - public function unlessNotEmpty(callable $callback, callable $default = null); + public function unlessNotEmpty(callable $callback, ?callable $default = null); /** * Filter items by the given key value pair. @@ -475,7 +475,7 @@ public function whereInstanceOf($type); * @param TFirstDefault|(\Closure(): TFirstDefault) $default * @return TValue|TFirstDefault */ - public function first(callable $callback = null, $default = null); + public function first(?callable $callback = null, $default = null); /** * Get the first item by the given key value pair. @@ -617,7 +617,7 @@ public function keys(); * @param TLastDefault|(\Closure(): TLastDefault) $default * @return TValue|TLastDefault */ - public function last(callable $callback = null, $default = null); + public function last(?callable $callback = null, $default = null); /** * Run a map over each of the items.