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

Make returntypes consistent with implementation #379

Merged
Merged
Show file tree
Hide file tree
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
12 changes: 1 addition & 11 deletions src/AbstractLazyCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,7 @@ public function findFirst(Closure $p)
}

/**
* @psalm-param Closure(T, TKey):bool $p
*
* @return ReadableCollection<mixed>
* @psalm-return ReadableCollection<TKey, T>
* {@inheritDoc}
*/
public function filter(Closure $p)
{
Expand All @@ -254,13 +251,6 @@ public function forAll(Closure $p)

/**
* {@inheritDoc}
*
* @psalm-param Closure(T):U $func
*
* @return ReadableCollection<mixed>
* @psalm-return ReadableCollection<TKey, U>
*
* @psalm-template U
*/
public function map(Closure $func)
{
Expand Down
21 changes: 21 additions & 0 deletions src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Doctrine\Common\Collections;

use ArrayAccess;
use Closure;

/**
* The missing (SPL) Collection/Array/OrderedMap interface.
Expand Down Expand Up @@ -79,4 +80,24 @@ public function removeElement(mixed $element);
* @return void
*/
public function set(string|int $key, mixed $value);

/**
* {@inheritDoc}
*
* @psalm-param Closure(T):U $func
*
* @return Collection<mixed>
* @psalm-return Collection<TKey, U>
*
* @psalm-template U
*/
public function map(Closure $func);

/**
* {@inheritDoc}
*
* @return Collection<mixed> A collection with the results of the filter operation.
* @psalm-return Collection<TKey, T>
*/
public function filter(Closure $p);
}