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

Another "not all code paths end in a return statement" case #4333

Closed
vudaltsov opened this issue Oct 15, 2020 · 1 comment
Closed

Another "not all code paths end in a return statement" case #4333

vudaltsov opened this issue Oct 15, 2020 · 1 comment
Labels

Comments

@vudaltsov
Copy link
Contributor

I have another issue that appeared in 3.17. I thought it will be covered by the fix for #4327, but the error is still thrown in 3.17.2.

https://psalm.dev/r/2945bcb25a

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/2945bcb25a
<?php

final class A
{
    private ?string $property = null;

    public function handle(string $arg): string
    {
        if (null !== $this->property) {
            return $arg;
        }

        try {
            return $arg;
        } finally {
        }
    }
}
Psalm output (using commit 2902a8c):

ERROR: InvalidReturnType - 7:42 - Not all code paths of A::handle end in a return statement, return type string expected

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

No branches or pull requests

2 participants