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

False positive UnusedMethodCall with ?? operator #5545

Closed
Etherlord opened this issue Mar 31, 2021 · 3 comments
Closed

False positive UnusedMethodCall with ?? operator #5545

Etherlord opened this issue Mar 31, 2021 · 3 comments
Labels

Comments

@Etherlord
Copy link

https://psalm.dev/r/6e69234550

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/6e69234550
<?php

$exception = new \Exception();

throw ($exception->getPrevious() ?? $exception);
Psalm output (using commit fe97aa0):

ERROR: UnusedMethodCall - 5:20 - The call to Exception::getPrevious is not used

@weirdan
Copy link
Collaborator

weirdan commented Mar 31, 2021

Since it works with return (https://psalm.dev/r/775f669643) it's likely a variation of the #5540

@weirdan weirdan added the bug label Mar 31, 2021
@psalm-github-bot
Copy link

psalm-github-bot bot commented Mar 31, 2021

I found these snippets:

https://psalm.dev/r/775f669643
<?php
function f(): Throwable {
$exception = new \Exception();

return ($exception->getPrevious() ?? $exception);
}
Psalm output (using commit fe97aa0):

No issues!

@muglug muglug closed this as completed in 517b203 Apr 5, 2021
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