Skip to content

Commit 1f87f48

Browse files
Feedback changes
1 parent 655538e commit 1f87f48

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/com/magento/idea/magento2plugin/inspections/php/fix/PhpImplementResolverClassQuickFix.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.jetbrains.php.lang.psi.PhpPsiElementFactory;
1313
import com.jetbrains.php.lang.psi.elements.PhpClass;
1414
import org.jetbrains.annotations.NotNull;
15+
import com.magento.idea.magento2plugin.util.magento.graphql.GraphQlUtil;
1516

1617
public 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
}

src/com/magento/idea/magento2plugin/util/magento/graphql/GraphQlUtil.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
public 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
}

0 commit comments

Comments
 (0)