- 
  Notifications
 You must be signed in to change notification settings 
- Fork 544
Don't generalize template types #1206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a @var is easy enough to write
Yeah but the same argument can be used to keep the current behaviour :)
BTW Can you please tell me which items from phpstan/phpstan#3853 (comment) do you plan to work on? Once I finish the memory optimization I'm working on right now, the only thing before releasing 1.6.0 is the finished support for conditional return types, so I'd like to get that over the finish line too :) Thanks.
a @var is easy enough to write
Yeah but the same argument can be used to keep the current behaviour :)
Definitely. Just throwing this out there :)
BTW Can you please tell me which items from phpstan/phpstan#3853 (comment) do you plan to work on? Once I finish the memory optimization I'm working on right now, the only thing before releasing 1.6.0 is the finished support for conditional return types, so I'd like to get that over the finish line too :) Thanks.
Sure. I'm planning on working on these today:
- New rule - is the type in ConditionalTypeNode part of the function's @template type map?
- New rule - does the parameter in ConditionalTypeForParameterNode exist?
I'm not sure how soon I'll get to any of the rest. I do realize that that doesn't help much, but I'd rather not make false promises.
Yeah, this is totally fine, I can take over some of the work myself, just wanted to make sure we're synchronized (I'll let you know when I'm gonna work on some of the tasks).
Just want to let you know that I probably won't be able to work on the conditional types this week. I was planning on doing more but life is busy as well :)
No problem, I'm gonna ping you once I take over a task :)
43dd811 to
 a5d9401  
 Compare
 
 efdf2c2 to
 c4747ec  
 Compare
 
 c4747ec to
 5d33443  
 Compare
 
 I'm interested in not generalizing the types, but IMHO it needs to be paired with this suggestion phpstan/phpstan#6732 (comment) to be usable. The whole thread is worth reading, but here I especially refer to the Collection<unresolved> part.
5d33443 to
 844fc94  
 Compare
 
 844fc94 to
 9aee02f  
 Compare
 
 a5d90c1 to
 a69c7f0  
 Compare
 
 Alright, I realized we can not-generalize types outside of GenericObjectType: #2818
But it's still a BC break so it's going to be bleeding edge-only for now.
Inside of GenericObjectType we're gonna need this logic phpstan/phpstan#6732 (comment)
But anyway this is still going to fix a lot of issues.
A little experiment to see what happens. Psalm doesn't generalize template types either, because a
@varis easy enough to write.