Skip to content

Commit

Permalink
Make returntypes consistend with implementation
Browse files Browse the repository at this point in the history
The implementation of filter and map are working on a Collection
and not on a ReadableCollection. Therefore they will also return
a Collection and not a ReadableCollection.
  • Loading branch information
heiglandreas committed Sep 28, 2023
1 parent 9eaa839 commit d909c56
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/AbstractLazyCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ public function findFirst(Closure $p)
/**
* @psalm-param Closure(T, TKey):bool $p
*
* @return ReadableCollection<mixed>
* @psalm-return ReadableCollection<TKey, T>
* @return Collection<mixed>
* @psalm-return Collection<TKey, T>

Check failure on line 236 in src/AbstractLazyCollection.php

View workflow job for this annotation

GitHub Actions / Static Analysis / Psalm (8.1)

MoreSpecificReturnType

src/AbstractLazyCollection.php:236:22: MoreSpecificReturnType: The declared return type 'Doctrine\Common\Collections\Collection<TKey:Doctrine\Common\Collections\AbstractLazyCollection as array-key, T:Doctrine\Common\Collections\AbstractLazyCollection as mixed>' for Doctrine\Common\Collections\AbstractLazyCollection::filter is more specific than the inferred return type 'Doctrine\Common\Collections\ReadableCollection<TKey:Doctrine\Common\Collections\AbstractLazyCollection as array-key, T:Doctrine\Common\Collections\AbstractLazyCollection as mixed>' (see https://psalm.dev/070)
*/
public function filter(Closure $p)
{
Expand All @@ -257,8 +257,8 @@ public function forAll(Closure $p)
*
* @psalm-param Closure(T):U $func
*
* @return ReadableCollection<mixed>
* @psalm-return ReadableCollection<TKey, U>
* @return Collection<mixed>
* @psalm-return Collection<TKey, U>

Check failure on line 261 in src/AbstractLazyCollection.php

View workflow job for this annotation

GitHub Actions / Static Analysis / Psalm (8.1)

MoreSpecificReturnType

src/AbstractLazyCollection.php:261:22: MoreSpecificReturnType: The declared return type 'Doctrine\Common\Collections\Collection<TKey:Doctrine\Common\Collections\AbstractLazyCollection as array-key, U:fn-doctrine\common\collections\abstractlazycollection::map as mixed>' for Doctrine\Common\Collections\AbstractLazyCollection::map is more specific than the inferred return type 'Doctrine\Common\Collections\ReadableCollection<TKey:Doctrine\Common\Collections\AbstractLazyCollection as array-key, U:fn-doctrine\common\collections\abstractlazycollection::map as mixed>' (see https://psalm.dev/070)
*
* @psalm-template U
*/
Expand Down

0 comments on commit d909c56

Please sign in to comment.