-
-
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
Add generics to ModelManagerInterface #6721
Conversation
I have some trouble to understand how the issue (#6713 (comment)) would come from the ModelManager since commenting the line I'm not sure those generics should be added. We generally use one ModelManager for every admin, and we're passing the class to most of the methods, so the modelManager shouldn't be related to one class |
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.
#6713 is solved.
And I don't think the modelManager should be restricted to one class, since every class-specific methods are taking a param $class
.
Could you please rebase your PR and fix merge conflicts? |
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.
I don't think it will work
https://phpstan.org/r/c9e2bf6d-3426-4a3f-8a96-cf96b8e98719
it depends, if the ModelManager it is for |
I don't see any benefit in this case. The issue you were trying to solve is solved, it shows that
works well without the generic. By adding a generic to ModelManager, you will forbid this code
But this code is valid. The ModelManager is not restricted to the class of the subject. |
Subject
This should fix #6713 (comment), I think the problem was that given:
This line
was not returning the same
T
. Now with:should be fine.
I am targeting this branch, because these changes are BC.
Changelog