@Nullable public MethodMatchParameter match() { if (!LaravelProjectComponent.isEnabled(psiElement)) { return null; } MethodReferenceBag bag = PhpElementsUtil.getMethodParameterReferenceBag(psiElement); if (bag == null) { return null; } // try on current method MethodMatcher.MethodMatchParameter methodMatchParameter = new StringParameterMatcher(psiElement, parameterIndex) .withSignature(this.signatures) .match(); if (methodMatchParameter != null) { return methodMatchParameter; } // walk down next method MethodReference methodReference = bag.getMethodReference(); Method method = Symfony2InterfacesUtil.getMultiResolvedMethod(methodReference); if (method == null) { return null; } PsiElement[] parameterReferences = PhpElementsUtil.getMethodParameterReferences(method, bag.getParameterBag().getIndex()); if (parameterReferences == null || parameterReferences.length == 0) { return null; } for (PsiElement var : parameterReferences) { MethodMatcher.MethodMatchParameter methodMatchParameterRef = new MethodMatcher.StringParameterMatcher(var, parameterIndex) .withSignature(this.signatures) .match(); if (methodMatchParameterRef != null) { return methodMatchParameterRef; } } return null; }
@Nullable public MethodMatchParameter match() { if (!LaravelProjectComponent.isEnabled(psiElement)) { return null; } MethodReferenceBag bag = PhpElementsUtil.getMethodParameterReferenceBag(psiElement, this.parameterIndex); if (bag == null) { return null; } CallToSignature matchedMethodSignature = this.isCallTo(bag.getMethodReference()); if (matchedMethodSignature == null) { return null; } return new MethodMatchParameter( matchedMethodSignature, bag.getParameterBag(), bag.getParameterList().getParameters(), bag.getMethodReference()); }