Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Enumerable.php #192

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/Collect/Support/Enumerable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down