use of com.jetbrains.php.lang.psi.elements.FieldReference in project phpinspectionsea by kalessil.
the class OpenapiPsiSearchUtil method findResolutionOperator.
/*
finds '::' or '->' node in a method reference and returns it;
we are aware of getReferenceType method, but we need operator itself for QF-ing
*/
@Nullable
public static PsiElement findResolutionOperator(@Nullable MemberReference reference) {
if (reference != null) {
final PhpPsiElement start = reference.getFirstPsiChild();
if (start != null) {
final PsiElement end = reference instanceof FieldReference ? reference.getLastChild() : start.getNextPsiSibling();
if (end != null) {
PsiElement current = start.getNextSibling();
while (current != null && current != end) {
final IElementType nodeType = current.getNode().getElementType();
if (nodeType == PhpTokenTypes.ARROW || nodeType == PhpTokenTypes.SCOPE_RESOLUTION) {
return current;
}
current = current.getNextSibling();
}
}
}
}
return null;
}
Aggregations