use of com.jetbrains.php.lang.psi.elements.Declare in project phpinspectionsea by kalessil.
the class DeclareDirectiveCorrectnessInspector method buildVisitor.
@Override
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
return new BasePhpElementVisitor() {
@Override
public void visitPhpDeclare(@NotNull Declare declare) {
final PsiElement declaration = declare.getFirstPsiChild();
final String declarationText = declaration == null ? null : declaration.getText();
if (declarationText != null && declarationText.indexOf('=') != -1) {
final String directive = declarationText.split("=")[0];
if (!directives.contains(directive.trim())) {
final String message = messagePattern.replace("%d%", directive);
holder.registerProblem(declare, message);
}
}
}
};
}
Aggregations