@Nullable protected CallToSignature isCallTo(MethodReference methodReference) { Symfony2InterfacesUtil interfacesUtil = new Symfony2InterfacesUtil(); for (CallToSignature signature : this.signatures) { if (interfacesUtil.isCallTo( methodReference, signature.getInstance(), signature.getMethod())) { return signature; } } return null; }
public static boolean isCallToWithParameter( PsiElement psiElement, String className, String methodName, int parameterIndex) { if (!(psiElement.getContext() instanceof ParameterList)) { return false; } ParameterList parameterList = (ParameterList) psiElement.getContext(); if (parameterList == null || !(parameterList.getContext() instanceof MethodReference)) { return false; } MethodReference method = (MethodReference) parameterList.getContext(); Symfony2InterfacesUtil interfacesUtil = new Symfony2InterfacesUtil(); if (!interfacesUtil.isCallTo(method, className, methodName)) { return false; } ParameterBag currentIndex = PsiElementUtils.getCurrentParameterIndex(psiElement); if (currentIndex == null || currentIndex.getIndex() != parameterIndex) { return false; } return true; }