|
9 | 9 | import com.jetbrains.php.lang.psi.elements.PhpNamedElement; |
10 | 10 | import com.jetbrains.php.lang.psi.elements.StringLiteralExpression; |
11 | 11 | import com.jetbrains.php.lang.psi.elements.Variable; |
12 | | -import com.jetbrains.php.lang.psi.resolve.types.PhpType; |
13 | 12 | import org.jetbrains.annotations.NotNull; |
14 | 13 |
|
15 | 14 | import java.util.Collection; |
16 | | -import java.util.Set; |
17 | 15 |
|
18 | 16 | public class IconReferenceContributor extends PsiReferenceContributor { |
19 | 17 |
|
@@ -47,19 +45,16 @@ public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNu |
47 | 45 |
|
48 | 46 | if (methodReference.getFirstPsiChild() instanceof Variable) { |
49 | 47 | Variable variable = (Variable) methodReference.getFirstPsiChild(); |
50 | | - PhpType inferredType = variable.getInferredType(); |
51 | | - Set<String> types = inferredType.getTypes(); |
52 | | - for (String type : types) { |
53 | | - try { |
54 | | - Collection<? extends PhpNamedElement> bySignature = PhpIndex.getInstance(element.getProject()).getBySignature(type); |
55 | | - for (PhpNamedElement el : bySignature) { |
56 | | - if (el.getFQN().equals(ICON_FACTORY) && methodName.equals("getIcon")) { |
57 | | - return new PsiReference[]{new IconReference(stringLiteralExpression)}; |
58 | | - } |
| 48 | + String signature = variable.getSignature(); |
| 49 | + Collection<? extends PhpNamedElement> bySignature = PhpIndex.getInstance(element.getProject()).getBySignature(signature); |
| 50 | + try { |
| 51 | + for (PhpNamedElement el : bySignature) { |
| 52 | + if (el.getFQN().equals(ICON_FACTORY) && methodName.equals("getIcon")) { |
| 53 | + return new PsiReference[]{new IconReference(stringLiteralExpression)}; |
59 | 54 | } |
60 | | - } catch (RuntimeException e) { |
61 | | - // invalid index signature, skip |
62 | 55 | } |
| 56 | + } catch (RuntimeException e) { |
| 57 | + // invalid index signature, skip |
63 | 58 | } |
64 | 59 | } |
65 | 60 |
|
|
0 commit comments