Problem with iterable in generics #9074
Unanswered
robotomarvin
asked this question in
Support
Replies: 1 comment 4 replies
-
PHPStan with your original example https://phpstan.org/r/17191b70-7aa3-4c35-9e6e-d3c17a4a9598 reports:
Does the linked article gives you the answer to your problem? Do you have any questions about the points in the article? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a problem with more complex combination of generics and iterable. As you can see in (https://phpstan.org/r/17191b70-7aa3-4c35-9e6e-d3c17a4a9598). Analysis is telling me
Pipeline<iterable<InputA>,iterable<InputA>>::addAction() expects Action<iterable<InputA>, iterable<InputB>>, AToB given.
butAToB
is actuallyAction<iterable<InputA>, iterable<InputB>>
I achieved it to work is wrapping iterable into a generic wrapper (https://phpstan.org/r/1bf8ef90-ec41-41e6-8c8a-ad20efd7513b), but that does seem right to me. Is there something I don't understand about covariance and contravariance? How would I go about this?
Beta Was this translation helpful? Give feedback.
All reactions