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

Type exclusion in switch is ignored #4792

Closed
akuzia opened this issue Apr 2, 2021 · 2 comments
Closed

Type exclusion in switch is ignored #4792

akuzia opened this issue Apr 2, 2021 · 2 comments

Comments

@akuzia
Copy link

akuzia commented Apr 2, 2021

Type checks in switch cases with return statements does not affect predicted type of a variable, but if statements do. In this example switch fills a similar role as if-elseif, but phpstan treats variable type checks and/or return statements inside cases differently:

https://phpstan.org/r/a876b5ee-8b62-405a-ac43-82bbcf9df446

@ondrejmirtes
Copy link
Member

Duplicate of #4499, #4413

@github-actions
Copy link

github-actions bot commented May 4, 2021

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 May 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants