Skip to content
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

Pass statement to MethodReturnTypeProviderEvent #6060

Merged
merged 2 commits into from
Jul 11, 2021

Conversation

VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Jul 7, 2021

I'm trying to solve the following issue on psalm-doctrine: psalm/psalm-plugin-doctrine#77

According to @orklah, this is possible if I can access to the statement from the MethodReturnTypeProviderEvent.

This require to update some signatures.
I added the $stmt param at the same position it was done in #5333
But maybe it can be improved. For instance, I see that both $stmt->args and $stmt are now pass to the getReturnType.

So maybe @muglug @weirdan, you'll prefer I change $stmt->args to $stmt in the original signature.
Or I can just pass $stmt->var.

Also, only the signature MethodReturnTypeProvider::getReturnType is changed ; maybe you'd like I update FunctionReturnTypeProvider::getReturnType too (and FunctionReturnTypeProviderEvent ?) in order to have a similar signature.

Of course, I'm opened to better solution in order to solve psalm/psalm-plugin-doctrine#77 (with psalm assert maybe ?)

@weirdan
Copy link
Collaborator

weirdan commented Jul 11, 2021

So maybe you'll prefer I change $stmt->args to $stmt in the original signature.

Yes, please. Naturally getCallArgs() method should stay, and just start returning $this->stmt->call_args.

It would be good to keep function type provider signature in sync with method one too.

@VincentLanglet
Copy link
Contributor Author

So maybe you'll prefer I change $stmt->args to $stmt in the original signature.

Yes, please. Naturally getCallArgs() method should stay, and just start returning $this->stmt->call_args.

It would be good to keep function type provider signature in sync with method one too.

Done ! @weirdan :)

@weirdan weirdan merged commit e93b37a into vimeo:master Jul 11, 2021
@weirdan
Copy link
Collaborator

weirdan commented Jul 11, 2021

Thanks!

@VincentLanglet VincentLanglet deleted the statement branch July 11, 2021 20:10
@VincentLanglet
Copy link
Contributor Author

Thanks. Is there any strategy about when the new releases are made ?

@weirdan
Copy link
Collaborator

weirdan commented Jul 12, 2021

I think @muglug just does that from time to time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants