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

Dead code detection: Support warning about variables that could be literals or constants #2704

Closed
TysonAndre opened this issue May 2, 2019 · 0 comments · Fixed by #2720
Closed
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

TysonAndre commented May 2, 2019

Do this if there is a single definition of a variable and no reference

// This is a constant expression that would be valid for a class constant, etc.
$values = [];
foreach ($other as $value) {
    // nothing in these statements modifies $values or takes a reference to $values
}
return $values;
@TysonAndre TysonAndre added enhancement This improves the quality of Phan's analysis of a codebase dead code detection Affects --dead-code-detection labels May 2, 2019
TysonAndre added a commit to TysonAndre/phan that referenced this issue May 2, 2019
TysonAndre added a commit to TysonAndre/phan that referenced this issue May 2, 2019
TysonAndre added a commit to TysonAndre/phan that referenced this issue May 2, 2019
TysonAndre added a commit to TysonAndre/phan that referenced this issue May 4, 2019
…able-detection

Fixes phan#2704
Fixes phan#2715

check for constant variables
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