1
1
package fr .adrienbrault .idea .symfony2plugin .navigation .controller ;
2
2
3
3
import com .intellij .psi .PsiElement ;
4
- import com .intellij .psi .PsiRecursiveElementVisitor ;
4
+ import com .jetbrains .php .codeInsight .controlFlow .PhpControlFlowUtil ;
5
+ import com .jetbrains .php .codeInsight .controlFlow .PhpInstructionProcessor ;
6
+ import com .jetbrains .php .codeInsight .controlFlow .instructions .PhpCallInstruction ;
5
7
import com .jetbrains .php .lang .psi .elements .MethodReference ;
6
8
import com .jetbrains .php .lang .psi .elements .PhpClass ;
7
9
import fr .adrienbrault .idea .symfony2plugin .Symfony2Icons ;
11
13
import fr .adrienbrault .idea .symfony2plugin .form .util .FormUtil ;
12
14
import fr .adrienbrault .idea .symfony2plugin .util .MethodMatcher ;
13
15
import org .apache .commons .lang .StringUtils ;
14
- import org .jetbrains .annotations .NotNull ;
15
16
16
17
import java .util .ArrayList ;
17
18
import java .util .Collection ;
@@ -27,14 +28,13 @@ public void collectGotoRelatedItems(ControllerActionGotoRelatedCollectorParamete
27
28
28
29
Collection <MethodReference > methodReferences = new ArrayList <>();
29
30
30
- parameter .getMethod ().acceptChildren ( new PsiRecursiveElementVisitor () {
31
+ PhpControlFlowUtil . processFlow ( parameter .getMethod ().getControlFlow (), new PhpInstructionProcessor () {
31
32
@ Override
32
- public void visitElement ( @ NotNull PsiElement element ) {
33
- if (element instanceof MethodReference ) {
34
- methodReferences .add (( MethodReference ) element );
33
+ public boolean processPhpCallInstruction ( PhpCallInstruction instruction ) {
34
+ if (instruction . getFunctionReference () instanceof MethodReference methodReference ) {
35
+ methodReferences .add (methodReference );
35
36
}
36
-
37
- super .visitElement (element );
37
+ return super .processPhpCallInstruction (instruction );
38
38
}
39
39
});
40
40
0 commit comments