-
-
Notifications
You must be signed in to change notification settings - Fork 932
Template Covariance and Extending Classes #9836
-
I'm struggling to understand why this is causing a type error. It is loosely based on Laravel's Models/Collections.
https://phpstan.org/r/02e1dd3b-fa0d-4c00-8e8f-6c6718912e94
I was able to find a similar issue here but it doesn't quite solve the issuing I'm having:
Should the theCollection function return MyCollection<int, Model> like phpstan is suggesting? I figured any class that inherits from the Model class would be acceptable.
Beta Was this translation helpful? Give feedback.
All reactions
There's an open bug for this: #2735
To work around the problem, you need to repeat the constructor in child classes: https://phpstan.org/r/190c32ad-e8c7-4809-8b1c-c1a9981fc3e5
Replies: 1 comment
-
There's an open bug for this: #2735
To work around the problem, you need to repeat the constructor in child classes: https://phpstan.org/r/190c32ad-e8c7-4809-8b1c-c1a9981fc3e5
Beta Was this translation helpful? Give feedback.