//look for used variables that were not declared before
+ findUnknownUsedVars(usedVars, declaredVars);
+ }
+
+ /**
+ * This method will add a warning on all used variables in a method that aren't declared before.
+ * @param usedVars the used variable list
+ * @param declaredVars the declared variable list
+ */
+ private void findUnknownUsedVars(final List usedVars, final List declaredVars) {
for (int i = 0; i < usedVars.size(); i++) {
VariableUsage variableUsage = (VariableUsage) usedVars.get(i);
if (!isVariableDeclaredBefore(declaredVars, variableUsage)) {
try {
- PHPParserSuperclass.setMarker("warning, usage of an unknown : " + variableUsage.getName(),
+ PHPParserSuperclass.setMarker("warning, usage of an unknown variable : " + variableUsage.getName(),
variableUsage.getStartOffset(),
variableUsage.getStartOffset() + variableUsage.getName().length(),
PHPParserSuperclass.WARNING,
PHPeclipsePlugin.log(e);
}
}
-
}
}
}