Skip to content

quick fix for VariableNotUsed could also delete unused assignment #6143

Open
@thefasquelle

Description

Justification
When a variable is unused but gets assigned, it triggers a VariableNotUsed Warnig along with an AssignmentNotUsed Hint.
The quick fix for VariableNotUsed does not delete the assignment, so it generates an UndeclaredVariable Error and we must delete it by hand.

Description
When an AssignmentNotUsed Hint and a VariableNotUsed Warning are targeting the same variable, the quickfix for VariableNotUsed could also delete the assignment. The name of the quick fix would be renamed to "Remove unused declaration and assignment" to be explicit about the whole refactoring. Or it could be added as a second quick fix option but I don't see why someone would actually use the first one anymore.

Metadata

Assignees

No one assigned

    Labels

    difficulty-02-duckyResolving these involves the internal API, but with relatively easy problems to solve.enhancementFeature requests, or enhancements to existing features. Ideas. Anything within the project's scope.feature-inspection-quickfixesup-for-grabsUse this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky

    Type

    No type

    Projects

    • Status

      To triage

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions