-
Notifications
You must be signed in to change notification settings - Fork 504
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
Fix parameter names for multi-variant functions #2726
Fix parameter names for multi-variant functions #2726
Conversation
Hi, this is my idea how to solve this problem: * d6685e7 We introduce The thinking behind that is that we already have the correct and official information thanks to https://github.com/phpstan/php-8-stubs. Can you please base your work off this branch? What remains to be done there:
What we shouldn't need to do at all:
|
You can also enhance the reflection golden test with information from |
Thanks for the feedback.
It would have to be
Interesting point, I haven't thought about that. But I'm not sure whether it still wouldn't be better in the long-term to have the parameter name correct in However, I now realized that you're right - |
I think we could disregard that some functions work with named arguments with multiple variants - the stubs in php-src simply say otherwise AFAIK. It might as well be a bug 😊 |
e97d698
to
82160c9
Compare
I reworked my previous attempt based on your branch. I allow multiple named arguments variants (the previous attempt did that as well so it was easy + it has greater flexibility for the future). I'm wondering if I should perhaps explain the purpose of I also didn't add the named arguments variants to the reflection golden test yet - it would fail the test and I want to see that there is no difference in the positional variants. So I'll add that after the PR is merged. |
This pull request has been marked as ready for review. |
This looks really promising! I'll do an in-depth review when time allows it. There are more issues changed by this, please make sure they pass as well (they should if the changes are correct): |
I really like this and couldn't find any issues :) Thank you very much! |
This is an attempt to fix parameter names for multi-variant functions (phpstan/phpstan#9849 (reply in thread)).
As far as I can tell, PHP uses the names from the "main" variant. I'm not sure how to use named and variadic parameters together, so I avoided those.