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

reduce method: more accurate types #394

Merged
merged 1 commit into from
Feb 22, 2024
Merged
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
6 changes: 3 additions & 3 deletions src/ReadableCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,11 @@ public function findFirst(Closure $p);
* Applies iteratively the given function to each element in the collection,
* so as to reduce the collection to a single value.
*
* @psalm-param Closure(TReturn|TInitial|null, T):(TInitial|TReturn) $func
* @psalm-param TInitial|null $initial
* @psalm-param Closure(TReturn|TInitial, T):TReturn $func
* @psalm-param TInitial $initial
Copy link
Contributor Author

@gharlan gharlan Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If $initial is not null, the closure does not need to accept null value for first param.

*
* @return mixed
* @psalm-return TReturn|TInitial|null
* @psalm-return TReturn|TInitial
*
* @psalm-template TReturn
* @psalm-template TInitial
Expand Down
Loading