-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Make ProxyQueryInterface generic #7909
Conversation
f8f434f
to
5976a41
Compare
This would be implemented this way for DoctrineORM |
5976a41
to
3708de2
Compare
If you have time to take a look @jordisala1991 |
Do we need to change something in the docs like add a phpstan-param to infer the type of execute or is infer automatically? If is manual, I think it would be nice to add it to docs (in the same example we have now) |
We never add some We didn't add any doc about the AdminInterface generic or CrudController. It's just how generics works and people should refer to the phpstan doc instead IMHO. When you're using Phpstan, on level 6 it will require to add the generic type. So you'll end up having to write
by yourself. |
@@ -18,6 +18,9 @@ | |||
|
|||
final class BatchOtherController | |||
{ | |||
/** | |||
* @param ProxyQueryInterface<object> $aCustomNameForTheProxyQuery |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I had in mind, I think it would be nice to be in docs too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the same idea that when you're doing Collection<Foo>
or AdminInterface<Foo>
.
But there is no documentation in Doctrine, or Symfony or Sonata about generics. I don't think that the place for it.
There could be a few cases:
In all cases I think is good to show how are you supose to use Sonata code if you want the best quality. IMO having it on docs, makes people that read docs see that Sonata is improving its quality by providing some nice DX. I dont say that we add all generics at once in this Pr, but I dont see a reason to not add them, if you use phpstan you will be thankful that we provide complete examples, if you dont you will remove it or not but wont hurt you. |
Subject
This will be for instance useful for batchActions, in order to infer the result of the query.
Changelog