Trying to define return type with generics #10755
Closed
wiseguy1394
started this conversation in
General
Replies: 1 comment 1 reply
-
I looked into your example and fixed returning the type. The problem is that with the setter you're actually changing the type so complaining about property type is correct here: https://phpstan.org/r/6b7c8636-5a49-4929-93fd-4b460f0bddf2 If your Data class was immutable and accepted generator in the constructor it'd be much simpler. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm trying to define a return type with generics but I can't figure it out:
https://phpstan.org/r/ceb81f77-1854-4b8f-a27f-adc334eae5d8
Thx for any help.
Beta Was this translation helpful? Give feedback.
All reactions