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

Incorrect Inspection for unused #1940

Open
TheEzraMiller opened this issue Apr 10, 2024 · 1 comment
Open

Incorrect Inspection for unused #1940

TheEzraMiller opened this issue Apr 10, 2024 · 1 comment

Comments

@TheEzraMiller
Copy link

Subject Details
Plugin Php Inspections (EA Extended)
Language level PHP 7.2

Current behaviour
Screenshot 2024-04-10 at 08 53 39
See sample code $var1 on line 8 is actually used if the if conditions are met hence it shouldn't be highlighted as unused by inspections

@ea-inspections-team
Copy link
Collaborator

Thank you for reporting @TheEzraMiller!

We are confirming the bug, and able to reproduce with the following example:

function example(bool $condition) {
    if ($condition) {
        $dynamic = '';
        $dynamic .= ''; // <-- [EA] Parameter/variable is overridden, but is never used or appears outside of the scope.
    }

    return $dynamic ?? null;
}

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

No branches or pull requests

2 participants