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

Add support for generics via static analysis #72

Open
alcaeus opened this issue Dec 6, 2019 · 7 comments · Fixed by #104
Open

Add support for generics via static analysis #72

alcaeus opened this issue Dec 6, 2019 · 7 comments · Fixed by #104
Labels
Enhancement New feature or request Help Wanted Extra attention is needed

Comments

@alcaeus
Copy link
Member

alcaeus commented Dec 6, 2019

As was done in doctrine/collections, we should add support for generics using the @psalm-template annotations for generic classes like Repositories and Registries. We should also ensure that generics in PHPStan are supported as well.

See doctrine/collections#177 for the reference implementation in collections.

@alcaeus alcaeus added Enhancement New feature or request Help Wanted Extra attention is needed labels Dec 6, 2019
@alcaeus
Copy link
Member Author

alcaeus commented Dec 19, 2019

https://github.com/weirdan/doctrine-psalm-plugin was brought to my attention today. @weirdan would you be open to contributing the annotations to our libraries directly? We've added them to doctrine/collections, but I'd love to see these in all other projects as well.

@weirdan
Copy link

weirdan commented Dec 19, 2019

But of course! What do I need to do to make that happen?

We should also ensure that generics in PHPStan are supported as well.

For the record, PHPStan reads some @psalm- annotations (including @template) and Psalm may soon start to read @phpstan--prefixed ones.

@alcaeus
Copy link
Member Author

alcaeus commented Dec 19, 2019

A pull request to master is a great start. If you want we can discuss this tomorrow in the symfony-devs or doctrine Slack 👍

@weirdan
Copy link

weirdan commented Dec 19, 2019

Unfortunately I won't have time for this before Sunday, so definitely not going to happen tomorrow.

@alcaeus
Copy link
Member Author

alcaeus commented Dec 20, 2019

No worries at all. I'll be off for most of the next two weeks, so please take some time to enjoy the holidays. No need to rush anything here.

@nschoellhorn
Copy link

I am also up for help if needed! Nice to see it get to other Doctrine projects as well.

@alcaeus
Copy link
Member Author

alcaeus commented Dec 29, 2019

@weirdan @nschoellhorn working with you on annotations was great! Would love to do this again for all persistence libraries. Right @Ocramius?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Help Wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants