2
2
* Copyright © Magento, Inc. All rights reserved.
3
3
* See COPYING.txt for license details.
4
4
*/
5
+
5
6
package com .magento .idea .magento2plugin .reference .provider ;
6
7
7
8
import com .intellij .openapi .util .text .StringUtil ;
15
16
import com .intellij .util .indexing .FileBasedIndex ;
16
17
import com .jetbrains .php .lang .PhpFileType ;
17
18
import com .jetbrains .php .lang .psi .PhpFile ;
18
- import com .magento .idea .magento2plugin .util .php .PhpPatternsHelper ;
19
19
import com .magento .idea .magento2plugin .reference .xml .PolyVariantReferenceBase ;
20
20
import com .magento .idea .magento2plugin .stubs .indexes .EventNameIndex ;
21
- import org .jetbrains .annotations .NotNull ;
22
-
21
+ import com .magento .idea .magento2plugin .util .php .PhpPatternsHelper ;
23
22
import java .util .ArrayList ;
24
23
import java .util .Collection ;
25
24
import java .util .List ;
25
+ import org .jetbrains .annotations .NotNull ;
26
26
27
27
public class EventNameReferenceProvider extends PsiReferenceProvider {
28
28
@@ -35,12 +35,14 @@ public PsiReference[] getReferencesByElement(
35
35
final String value = StringUtil .unquoteString (element .getText ());
36
36
final List <PsiReference > psiReferences = new ArrayList <>();
37
37
final Collection <VirtualFile > containingFiles = FileBasedIndex .getInstance ()
38
- .getContainingFiles (EventNameIndex .KEY , value ,
39
- GlobalSearchScope .getScopeRestrictedByFileTypes (
40
- GlobalSearchScope .allScope (element .getProject ()),
41
- PhpFileType .INSTANCE
42
- )
43
- );
38
+ .getContainingFiles (
39
+ EventNameIndex .KEY ,
40
+ value ,
41
+ GlobalSearchScope .getScopeRestrictedByFileTypes (
42
+ GlobalSearchScope .allScope (element .getProject ()),
43
+ PhpFileType .INSTANCE
44
+ )
45
+ );
44
46
45
47
final PsiManager psiManager = PsiManager .getInstance (element .getProject ());
46
48
final List <PsiElement > psiElements = new ArrayList <>();
@@ -49,7 +51,7 @@ public PsiReference[] getReferencesByElement(
49
51
if (phpFile != null ) {
50
52
recursiveFill (psiElements , phpFile , value );
51
53
if (!psiElements .isEmpty ()) {
52
- psiReferences .add (new PolyVariantReferenceBase (element , psiElements ));
54
+ psiReferences .add (new PolyVariantReferenceBase (element , psiElements ));//NOPMD
53
55
break ;
54
56
}
55
57
}
0 commit comments