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

Unused global variable when using list #89

Closed
kkmuffme opened this issue May 11, 2019 · 3 comments
Closed

Unused global variable when using list #89

kkmuffme opened this issue May 11, 2019 · 3 comments
Labels

Comments

@kkmuffme
Copy link

function abc() {
    global $test;
    list( $test, $example ) = my_function( $_POST );

    return $example;
}

will report:
Unused global variable $test.

But it isn't unused, since we assign a new value to it.

@sirbrillig
Copy link
Owner

This sounds very similar to #81, but perhaps it isn't covered since the assignment is done via list assignment.

@sirbrillig sirbrillig added the bug label May 14, 2019
@kkmuffme
Copy link
Author

Yes thanks. Issue is fixed there.

sirbrillig added a commit that referenced this issue May 14, 2019
This is a follow-up to #83 which allows global assignments to count as
"reads" for the sake of marking unused variables.

Demonstrates the fix to #89
@sirbrillig
Copy link
Owner

I added 8611e83 to make sure the case you mentioned above is covered by tests. Please let me know if you find a problem with it!

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