Teach to understand complex expressions. #10673
-
Hi guys. Maybe somebody could help me to teach PHPStan to understand the following code snippet: https://phpstan.org/r/d53c9db0-e232-4644-83e5-638efaaedbdf Actually I'd like to teach PHPStan to see the real object which Symfony Serializer returns on line 38. I guess I need to play with generics but not sure who exactly. Appreciate any help. Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This is exactly the use case described here: https://phpstan.org/blog/generics-by-examples#couple-relevant-classes-together You need to couple RequestObj and ResponseObj together using generics. |
Beta Was this translation helpful? Give feedback.
-
Thank you @ondrejmirtes. Sorry didn't check articles in blog. My bad |
Beta Was this translation helpful? Give feedback.
This is exactly the use case described here: https://phpstan.org/blog/generics-by-examples#couple-relevant-classes-together
You need to couple RequestObj and ResponseObj together using generics.