-
Notifications
You must be signed in to change notification settings - Fork 14
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 warning when global variable is written to #81
Comments
Wow, that is a bug. I actually don't think we handle the |
I'm not entirely familiar with the code, but it looks like if you added a call to |
Nope....that's not gonna work. |
Yeah, that's looking for the variable declaration. I was wrong, we are checking for the global keyword, so there's something wrong with that. 🤔 |
Looks like in How do you check if the variable is global? |
Or is this something that isn't kept track of yet? |
Global variables are a little complicated (see #37) but I am tracking their declaration with the Really we just want to see if the variable has been declared within the scope ( |
Gah, jetlag is clouding my brain. The issue as I understand it is that for some reason the assignment Possibly helpful note to self: There's a test to recreate the issue here: https://github.com/sirbrillig/phpcs-variable-analysis/pull/83/files Debug mode can be triggered by doing this: |
Found it. Global imports just need to be treated like pass-by-reference. |
Thanks!
On Mon, Apr 22, 2019 at 14:18 Payton Swick ***@***.***> wrote:
Closed #81
<#81> via #83
<#83>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#81 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AACYYJ4OJBB6HXH2IUVHFC3PRYTUDANCNFSM4HG75NNQ>
.
--
Sent while on the go.
|
Say I have this function:
I will get the following message:
It seems like this is an erroneous message. Or at least it should be configurable.
Currently, I'm able to get around the warning this way:
But this is not ideal.
The text was updated successfully, but these errors were encountered: