Problem with templates and code reuse #10873
-
I have So there can be multiple UI elements: class Toggle extends BaseElementWithValue<TValue = bool> { ... }
class Input extends BaseElementWithValue<TValue = string> { ... }
(new Toggle(...))->getValue(); /*returns bool*/
(new Input(...))->getValue()); /*returns string*/ Then I want to pass an array of these elements to parameters with type Example: https://phpstan.org/r/ee15750b-730c-4f7d-aa95-f13f46695685 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
What's your question? One possible solution to the error is:https://phpstan.org/r/c364dacb-1f1f-448e-9177-5b0e9e0d4279 See: https://phpstan.org/blog/guide-to-call-site-generic-variance |
Beta Was this translation helpful? Give feedback.
What's your question?
One possible solution to the error is:https://phpstan.org/r/c364dacb-1f1f-448e-9177-5b0e9e0d4279
See: https://phpstan.org/blog/guide-to-call-site-generic-variance