You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seem like filter method docbloc is missconfigured or something alike between Collection/ReadableCollection.
With doctrine/collections 2.1.2 and phpstan/phpstan-doctrine 1.3.32 i get a phpstan error on a valid code before update (1.7.2 => 2.1.2)
Here a phpstan playground to expose how we process to get the error : playground
We get :
Method Test::getFiltered() should return Collection<int, int> but returns ReadableCollection<int, int>.
I can avoid the error by adding this in Collection interface but I'm not sure that it is logical with your choice of create a ReadableCollection interface.
/**
* {@inheritDoc}
*
* @return static
* @psalm-return static<TKey,T>
*/
public function filter(Closure $p);
If it's not the solution, how can I manage to avoid the error in the context of a collection instancied as ArrayCollection that we would filter ? What is the best approach ?
Thank for your time
The text was updated successfully, but these errors were encountered:
HI,
I report here my problem after being redirected by phpstan, see issue here : #phpstan/phpstan-doctrine#428
Seem like filter method docbloc is missconfigured or something alike between Collection/ReadableCollection.
With doctrine/collections 2.1.2 and phpstan/phpstan-doctrine 1.3.32 i get a phpstan error on a valid code before update (1.7.2 => 2.1.2)
Here a phpstan playground to expose how we process to get the error : playground
We get :
I can avoid the error by adding this in Collection interface but I'm not sure that it is logical with your choice of create a ReadableCollection interface.
If it's not the solution, how can I manage to avoid the error in the context of a collection instancied as ArrayCollection that we would filter ? What is the best approach ?
Thank for your time
The text was updated successfully, but these errors were encountered: