-
Notifications
You must be signed in to change notification settings - Fork 7.9k
gen_stub.php
: Allowed the use of formats like @param array<>
#18924
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
Do you have an example where this would be used? |
No, it doesn’t seem necessary for the current code. |
I was just wondering what that prototype was, in case it could be accomplished with the existing support |
Ah, I see. |
That is definitely already possible for return values, e.g. php-src/ext/standard/basic_functions.stub.php Line 1546 in d6fc743
And from what I can see the What error are you getting if you try |
The exception I am encountering is this one: Line 4538 in d6fc743
edit: Sorry, that might not be correct ↑ edit2: Understood. This method is probably not used for Line 4682 in d6fc743
In param, if Line 4530 in d6fc743
|
Ah, okay, so the type gets extracted, but not the name? Then this patch makes sense to me, but I'll leave final approval for @kocsismate |
The original rationale behind the current behavior is that stubs should contain type info that is directly consumed by php-src or php-doc. That's why return types can contain detailed array shape type doc because the optimizer uses the information. Later on, this was slightly changed. I think Bob made some extended syntax possible (see the comment above the changed code). So I'm approving the changes. |
This doesn’t change any output, but it makes it easier to provide hints for PHPStan or IDEs.