Skip to content

Commit

Permalink
magic methods fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
maxfilatov committed Jan 11, 2016
1 parent e02fadb commit 1725da4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/com/phpuaca/annotator/StringAnnotator.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder a
Method method = phpClass.findMethodByName(name);
TextRange textRange = psiElement.getTextRange();
TextRange annotationTextRange = new TextRange(textRange.getStartOffset() + 1, textRange.getEndOffset() - 1);
if (method == null && phpClass.findFieldByName(name, false) == null) {
annotationHolder.createWarningAnnotation(annotationTextRange, "Method '" + name + "' not found in class " + phpClass.getName());
} else if (!filter.isMethodAllowed(method)) {
annotationHolder.createWarningAnnotation(annotationTextRange, "Method '" + name + "' is not allowed to use here");
if (method == null) {
if (phpClass.findFieldByName(name, false) == null) {
annotationHolder.createWarningAnnotation(annotationTextRange, "Method '" + name + "' not found in class " + phpClass.getName());
}
} else {
if (!filter.isMethodAllowed(method)) {
annotationHolder.createWarningAnnotation(annotationTextRange, "Method '" + name + "' is not allowed to use here");
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/com/phpuaca/filter/Filter.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected boolean isMethodAllowed(String methodName) {
}

public boolean isMethodAllowed(Method method) {
return !(method instanceof PhpDocMethod) && isMethodAllowed(method.getName()) && isModifierAllowed(method.getModifier());
return isMethodAllowed(method.getName()) && isModifierAllowed(method.getModifier());
}

public boolean isMethodDescribed(String methodName) {
Expand Down

0 comments on commit 1725da4

Please sign in to comment.