|
6 | 6 | import com.jetbrains.php.lang.PhpLanguage;
|
7 | 7 | import com.jetbrains.php.lang.psi.elements.PhpClass;
|
8 | 8 | import com.jetbrains.php.lang.psi.elements.StringLiteralExpression;
|
9 |
| -import fr.adrienbrault.idea.symfony2plugin.Symfony2ProjectComponent; |
| 9 | +import fr.adrienbrault.idea.symfony2plugin.dic.MapClassReference; |
10 | 10 | import fr.adrienbrault.idea.symfony2plugin.dic.ServiceReference;
|
11 | 11 | import fr.adrienbrault.idea.symfony2plugin.doctrine.EntityHelper;
|
12 | 12 | import fr.adrienbrault.idea.symfony2plugin.doctrine.EntityReference;
|
13 | 13 | import fr.adrienbrault.idea.symfony2plugin.doctrine.ModelFieldReference;
|
14 | 14 | import fr.adrienbrault.idea.symfony2plugin.doctrine.dict.DoctrineTypes;
|
15 | 15 | import fr.adrienbrault.idea.symfony2plugin.templating.TemplateReference;
|
| 16 | +import fr.adrienbrault.idea.symfony2plugin.util.CommandUtil; |
16 | 17 | import fr.adrienbrault.idea.symfony2plugin.util.MethodMatcher;
|
17 | 18 | import fr.adrienbrault.idea.symfony2plugin.util.PhpElementsUtil;
|
18 | 19 | import org.jetbrains.annotations.NotNull;
|
@@ -45,6 +46,12 @@ public class SymfonyPhpReferenceContributor extends PsiReferenceContributor {
|
45 | 46 | new MethodMatcher.CallToSignature("\\Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller", "stream"),
|
46 | 47 | };
|
47 | 48 |
|
| 49 | + public static MethodMatcher.CallToSignature[] CONSOLE_HELP_SET = new MethodMatcher.CallToSignature[] { |
| 50 | + new MethodMatcher.CallToSignature("\\Symfony\\Component\\Console\\Helper\\HelperSet", "get"), |
| 51 | + new MethodMatcher.CallToSignature("\\Symfony\\Component\\Console\\Helper\\HelperSet", "has"), |
| 52 | + new MethodMatcher.CallToSignature("\\Symfony\\Component\\Console\\Command\\Command", "getHelper"), |
| 53 | + }; |
| 54 | + |
48 | 55 | @Override
|
49 | 56 | public void registerReferenceProviders(PsiReferenceRegistrar psiReferenceRegistrar) {
|
50 | 57 |
|
@@ -149,6 +156,21 @@ public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @No
|
149 | 156 | }
|
150 | 157 | );
|
151 | 158 |
|
| 159 | + psiReferenceRegistrar.registerReferenceProvider( |
| 160 | + PlatformPatterns.psiElement(StringLiteralExpression.class), |
| 161 | + new PsiReferenceProvider() { |
| 162 | + @NotNull |
| 163 | + @Override |
| 164 | + public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext processingContext) { |
| 165 | + |
| 166 | + if (MethodMatcher.getMatchedSignatureWithDepth(psiElement, CONSOLE_HELP_SET) == null) { |
| 167 | + return new PsiReference[0]; |
| 168 | + } |
| 169 | + |
| 170 | + return new PsiReference[]{ new MapClassReference((StringLiteralExpression) psiElement, CommandUtil.getCommandHelper(psiElement.getProject()))}; |
| 171 | + } |
| 172 | + } |
| 173 | + ); |
152 | 174 |
|
153 | 175 | }
|
154 | 176 |
|
|
0 commit comments