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

non-void function in untyped void function lead to sometimes returns something #2682

Closed
adaamz opened this issue Dec 6, 2019 · 3 comments
Closed
Labels
Milestone

Comments

@adaamz
Copy link
Contributor

adaamz commented Dec 6, 2019

Bug report

When we have void anonymous function that has non-void returning anonymous function, phpstan is unable to declare that outer function "returns" void.

Code snippet that reproduces the problem

https://phpstan.org/r/51e621e4-3353-43ee-ad98-73099ad897cd

Expected output

Anonymous function should have native return typehint "void".

Current output

Anonymous function sometimes return something but return statement at the end is missing.

@ondrejmirtes
Copy link
Member

You're right, we shouldn't dive into nested closures.

@ondrejmirtes
Copy link
Member

Related problem: https://phpstan.org/r/bf7c1af2-4063-4ee0-8d04-3aa3a987754b

Expected: Anonymous function should have native return typehint "stdClass".

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants