File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
src/com/magento/idea/magento2plugin Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 12
12
import com .jetbrains .php .lang .psi .PhpPsiElementFactory ;
13
13
import com .jetbrains .php .lang .psi .elements .PhpClass ;
14
14
import org .jetbrains .annotations .NotNull ;
15
+ import com .magento .idea .magento2plugin .util .magento .graphql .GraphQlUtil ;
15
16
16
17
public class PhpImplementResolverClassQuickFix implements LocalQuickFix {
17
18
@ NotNull
@@ -22,8 +23,8 @@ public String getFamilyName() {
22
23
23
24
@ Override
24
25
public void applyFix (@ NotNull Project project , @ NotNull ProblemDescriptor descriptor ) {
25
- PsiElement correctInterface = PhpPsiElementFactory .createImplementsList (project , " \\ Magento \\ Framework \\ GraphQl \\ Query \\ ResolverInterface" );
26
- PhpClass GraphQlResolverclass = (PhpClass ) descriptor .getPsiElement ().getParent ();
27
- GraphQlResolverclass .getImplementsList ().replace (correctInterface );
26
+ PsiElement correctInterface = PhpPsiElementFactory .createImplementsList (project , GraphQlUtil . RESOLVER_INTERFACE );
27
+ PhpClass graphQlResolverClass = (PhpClass ) descriptor .getPsiElement ().getParent ();
28
+ graphQlResolverClass .getImplementsList ().replace (correctInterface );
28
29
}
29
30
}
Original file line number Diff line number Diff line change 12
12
13
13
public class GraphQlUtil {
14
14
15
+ public static final String RESOLVER_INTERFACE = "\\ Magento\\ Framework\\ GraphQl\\ Query\\ ResolverInterface" ;
16
+
15
17
@ NotNull
16
18
public static String resolverStringToPhpFQN (String resolverFQN ) {
17
19
resolverFQN = resolverFQN .replace ("\\ \\ " , "\\ " ).replace ("\" " ,"" );
@@ -45,13 +47,11 @@ public static GraphQLStringValue fetchResolverQuotedStringFromArgument(PsiElemen
45
47
public static boolean isResolver (PhpClass psiElement ) {
46
48
PhpClass [] implementedInterfaces = psiElement .getImplementedInterfaces ();
47
49
for (PhpClass implementedInterface : implementedInterfaces ) {
48
- if (!implementedInterface .getFQN ().equals (" \\ Magento \\ Framework \\ GraphQl \\ Query \\ ResolverInterface" )) {
50
+ if (!implementedInterface .getFQN ().equals (RESOLVER_INTERFACE )) {
49
51
continue ;
50
52
}
51
53
return false ;
52
54
}
53
55
return true ;
54
56
}
55
-
56
-
57
57
}
You can’t perform that action at this time.
0 commit comments