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 1212import com .jetbrains .php .lang .psi .PhpPsiElementFactory ;
1313import com .jetbrains .php .lang .psi .elements .PhpClass ;
1414import org .jetbrains .annotations .NotNull ;
15+ import com .magento .idea .magento2plugin .util .magento .graphql .GraphQlUtil ;
1516
1617public class PhpImplementResolverClassQuickFix implements LocalQuickFix {
1718 @ NotNull
@@ -22,8 +23,8 @@ public String getFamilyName() {
2223
2324 @ Override
2425 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 );
2829 }
2930}
Original file line number Diff line number Diff line change 1212
1313public class GraphQlUtil {
1414
15+ public static final String RESOLVER_INTERFACE = "\\ Magento\\ Framework\\ GraphQl\\ Query\\ ResolverInterface" ;
16+
1517 @ NotNull
1618 public static String resolverStringToPhpFQN (String resolverFQN ) {
1719 resolverFQN = resolverFQN .replace ("\\ \\ " , "\\ " ).replace ("\" " ,"" );
@@ -45,13 +47,11 @@ public static GraphQLStringValue fetchResolverQuotedStringFromArgument(PsiElemen
4547 public static boolean isResolver (PhpClass psiElement ) {
4648 PhpClass [] implementedInterfaces = psiElement .getImplementedInterfaces ();
4749 for (PhpClass implementedInterface : implementedInterfaces ) {
48- if (!implementedInterface .getFQN ().equals (" \\ Magento \\ Framework \\ GraphQl \\ Query \\ ResolverInterface" )) {
50+ if (!implementedInterface .getFQN ().equals (RESOLVER_INTERFACE )) {
4951 continue ;
5052 }
5153 return false ;
5254 }
5355 return true ;
5456 }
55-
56-
5757}
You can’t perform that action at this time.
0 commit comments