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

don't emit issue for functions or class after a never-returning function call #6827

Closed
orklah opened this issue Nov 5, 2021 · 3 comments · Fixed by #6828
Closed

don't emit issue for functions or class after a never-returning function call #6827

orklah opened this issue Nov 5, 2021 · 3 comments · Fixed by #6828
Labels

Comments

@orklah
Copy link
Collaborator

orklah commented Nov 5, 2021

https://psalm.dev/r/d043c70a10?php=8.1

@psalm-github-bot
Copy link

psalm-github-bot bot commented Nov 5, 2021

I found these snippets:

https://psalm.dev/r/d043c70a10
<?php

function neverReturns(): never{
 	die();   
}
unrelated();
neverReturns();

function unrelated(){
    echo "hello";
}
Psalm output (using commit 670c740):

ERROR: UnevaluatedCode - 9:1 - Expressions after return/throw/continue

@weirdan
Copy link
Collaborator

weirdan commented Nov 5, 2021

Did you mean you wanted something to be emitted (e.g. MissingReturnType)?

@orklah
Copy link
Collaborator Author

orklah commented Nov 5, 2021

No, I want to prevent the emission of UnevaluatedCode because even when the function is declared after the never-returning call, it's still allowed by PHP: https://3v4l.org/3HPc0

UnevaluatedCode implies that the code could be deleted but it can't

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

Successfully merging a pull request may close this issue.

2 participants