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

Classes extending ArrayCollection getting psalm errors since psalm 3.6.6 #223

Closed
sspat opened this issue Dec 7, 2019 · 5 comments
Closed

Comments

@sspat
Copy link

sspat commented Dec 7, 2019

Considering this code:

<?php

use Doctrine\Common\Collections\ArrayCollection;

$extendedCollection = new class ([]) extends ArrayCollection {};
$extendedCollection->filter(fn () => true);

Since this change in psalm released in version 3.6.6:
vimeo/psalm#2326

When analyzing the code above with psalm I get the following error:

ERROR: TooManyTemplateParams - src/Application/test.php:6:1 - _var_www_src_Application_test_php_5_87 has too many template params, expecting 0
$extendedCollection->filter(fn () => true)
@Ocramius
Copy link
Member

Ocramius commented Dec 7, 2019

I don't think this is a bug with doctrine/collections per-se: suggest reproducing with a minimal scenario (without doctrine/collections) and reporting upstream.

@sspat
Copy link
Author

sspat commented Dec 9, 2019

Thank you, will continue there! That one was tricky to reproduce in isolation.

@muglug
Copy link
Contributor

muglug commented Dec 9, 2019

So it sort of is - at least, since that PR, @return static<TKey, TValue> is unnecessary (and can generate errors in descendant classes that aren't templated) whereas @return static now works. But I'll add a workaround.

@muglug
Copy link
Contributor

muglug commented Jan 2, 2020

This can be closed now

@greg0ire greg0ire closed this as completed Jan 2, 2020
@greg0ire
Copy link
Member

greg0ire commented Jan 2, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants