Manageability
High
Lightning
SF-0058
A for-in loop in which the variable name is not explicitly scoped to the enclosing scope with the var keyword can refer to a variable in an enclosing scope outside the nearest enclosing scope. This will overwrite the existing value of the variable in the outer scope when the body of the for-in is evaluated.
Always use the var keyword to declare variables inside for-in loops.
45 min
See the PMD documentation article: ScopeForInVariable.