-
Notifications
You must be signed in to change notification settings - Fork 56
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
Generify collections using Psalm #61
Comments
I am working on this right now in the form of a Psalm plugin. The goal is to make it play nicely with both PHPStan and Psalm. The issue right now is that PHPStan wants it in the form of The idea of the plugin is to make Psalm accept 2 forms: TLDR; I am writing a Psalm plugin for this right now, so if you wait a day or two, it will be done. The plugin can be then ported into v 11.*. |
Sounds great! :) Take a look at the changes done in the v11, we will be changing all the returned |
This is from straight from Psalm documentation: <?php
/**
* @template T
*/
trait MyTrait {}
class Foo {
/**
* @use MyTrait<Foo>
*/
use MyTrait;
} I am not sure how well it works for PHPStan, but for Psalm, if client code for the use of the trait would look like this, they in the trait you have access to the client class name. For anyone interested in helping, https://github.com/Dance-Engineer/psalm-knapsack-collections is the plugin. Since I am a templating newbie, I would appreciate any help. The plugin is installable and works, but some of the templates are wrong and cause errors even when they should not. PRs are welcomed. One sorted, it can be ported to this REPO and only exists for people using <v11. |
What if you will all phpstan or psalm specific tags, like
|
I implemented Psalm annotations for the collection functions, CollectionTrait, CollectionInterface and the Collection in #63. There are still 10 "other issues" I can't really wrap my head around so any help is welcome :) It's stuff like:
|
Since this collections lib is quite popular.
I would like to suggest it to use generics/template types like
doctrine/collections
does. This will make it more type safe to use this collectionsThe text was updated successfully, but these errors were encountered: