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

Variable variables are considered unused on assignment left-hand side #84

Closed
loilo opened this issue May 7, 2019 · 2 comments · Fixed by #88
Closed

Variable variables are considered unused on assignment left-hand side #84

loilo opened this issue May 7, 2019 · 2 comments · Fixed by #88
Labels

Comments

@loilo
Copy link
Contributor

loilo commented May 7, 2019

Variable variables are considered unused when only appearing on the left-hand side of an assignment.

This is considered fine:

function fn()
{
    $foo = true;
    $var = 'foo';
    return $$var;
}

While this says $var is unused:

function fn()
{
    $foo = true;
    $var = 'foo';
    $$var = false;
}

($foo is marked unused in both cases, but I guess there's no way to avoid that without deeper program flow analysis.)

@sirbrillig
Copy link
Owner

Thanks! Wow, variable variables are tough. I created #87 to track the fact that they are hard to deal with.

In the mean time, #88 should solve this.

@loilo
Copy link
Contributor Author

loilo commented May 10, 2019

Thanks! 🙂

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

Successfully merging a pull request may close this issue.

2 participants