Skip to content

Commit b5dec3c

Browse files
committed
Match constants correctly
1 parent ab54ac0 commit b5dec3c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/com/cedricziel/idea/typo3/extensionScanner/codeInspection/ConstantMatcherInspection.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,20 @@ public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder problemsHolder, bo
4343
@Override
4444
public void visitPhpElement(PhpPsiElement element) {
4545

46-
if (!PlatformPatterns.psiElement(PhpElementTypes.CLASS_REFERENCE).accepts(element)) {
46+
if (!PlatformPatterns.psiElement(PhpElementTypes.CONSTANT_REF).accepts(element)) {
4747
return;
4848
}
4949

50-
Set<String> constants = getRemovedConstantsFQNs(element);
5150
ConstantReference constantReference = (ConstantReference) element;
51+
Set<String> constants = getRemovedConstantsFQNs(constantReference);
5252
if (constants.contains(constantReference.getFQN())) {
5353
problemsHolder.registerProblem(element, "Constant removed with TYPO3 9, consider using an alternative");
5454
}
5555
}
5656
};
5757
}
5858

59-
private Set<String> getRemovedConstantsFQNs(PhpPsiElement element) {
59+
private Set<String> getRemovedConstantsFQNs(ConstantReference element) {
6060
Set<PsiElement> elements = new HashSet<>();
6161
PsiFile[] constantMatcherFiles = FilenameIndex.getFilesByName(element.getProject(), "ConstantMatcher.php", GlobalSearchScope.allScope(element.getProject()));
6262
for (PsiFile file : constantMatcherFiles) {

0 commit comments

Comments
 (0)