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

PhanUnusedVariable not detected with try-catch where catch always rethrows #4567

Closed
TysonAndre opened this issue Oct 5, 2021 · 0 comments · Fixed by #4568
Closed

PhanUnusedVariable not detected with try-catch where catch always rethrows #4567

TysonAndre opened this issue Oct 5, 2021 · 0 comments · Fixed by #4568
Labels
dead code detection Affects --dead-code-detection enhancement This improves the quality of Phan's analysis of a codebase

Comments

@TysonAndre
Copy link
Member

<?php

function example() {
    $var = 123;  // properly warns
    $x = null;
    try {
        $x = 123;
    } catch (Exception $e) {
        throw $e;
    }
    return $x;
}
@TysonAndre TysonAndre added enhancement This improves the quality of Phan's analysis of a codebase dead code detection Affects --dead-code-detection labels Oct 5, 2021
TysonAndre added a commit to TysonAndre/phan that referenced this issue Oct 6, 2021
where catch always rethrows/returns or try always rethrows/returns.

Closes phan#4567
TysonAndre added a commit to TysonAndre/phan that referenced this issue Oct 6, 2021
where catch always rethrows/returns or try always rethrows/returns.

Closes phan#4567
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dead code detection Affects --dead-code-detection enhancement This improves the quality of Phan's analysis of a codebase
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant