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 for "unused" variable in try-catch #7613
Comments
I found these snippets: https://psalm.dev/r/585b7b7e67<?php
/**
* @throws Exception
*/
function mayThrow(): void {}
$step = 'zero';
try {
$step = 'one';
mayThrow();
$step = 'two';
mayThrow();
} catch (Throwable) {
echo $step;
}
|
I would expect |
That too: without |
I think Psalm just assumes it's possible that an exception is thrown immediately upon entering a I might take a look at this tomorrow if no one else grabs it, I'm hoping it won't be too hard, but we'll see. I'm not sure if we still have a way to get at the |
Took me longer than I'd hoped to get around to it, but I managed to find an alternate fix. |
…le-in-try Fix false positive for unused variable in try (fixes #7613).
https://psalm.dev/r/585b7b7e67
The text was updated successfully, but these errors were encountered: