persistence
persistence copied to clipboard
Add support for generics via static analysis
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 https://github.com/doctrine/collections/pull/177 for the reference implementation in collections.
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.
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.
A pull request to master is a great start. If you want we can discuss this tomorrow in the symfony-devs or doctrine Slack 👍
Unfortunately I won't have time for this before Sunday, so definitely not going to happen tomorrow.
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.
I am also up for help if needed! Nice to see it get to other Doctrine projects as well.
@weirdan @nschoellhorn working with you on annotations was great! Would love to do this again for all persistence libraries. Right @ocramius?