|
13 | 13 | import com.jetbrains.php.lang.psi.elements.Parameter; |
14 | 14 | import com.jetbrains.php.lang.psi.elements.PhpReturnType; |
15 | 15 | import com.magento.idea.magento2plugin.actions.generation.data.code.PluginMethodData; |
| 16 | +import com.magento.idea.magento2plugin.actions.generation.generator.util.PhpClassGeneratorUtil; |
16 | 17 | import com.magento.idea.magento2plugin.actions.generation.references.PhpClassReferenceResolver; |
17 | 18 | import com.magento.idea.magento2plugin.util.php.PhpTypeMetadataParserUtil; |
18 | 19 | import java.util.ArrayList; |
@@ -55,19 +56,19 @@ public void execute( |
55 | 56 | final PsiElement targetClass = (PsiElement) pluginMethod.getTargetMethod() |
56 | 57 | .getUserData(targetClassKey); |
57 | 58 | resolver.processElement(targetClass); |
58 | | - PhpReturnType returnType = targetMethod.getReturnType(); |
| 59 | + |
59 | 60 | final String returnTypeFqn = |
60 | 61 | PhpTypeMetadataParserUtil.getMethodReturnType(targetMethod); |
61 | 62 |
|
62 | | - if (returnType == null && returnTypeFqn != null) { |
63 | | - returnType = PhpPsiElementFactory.createReturnType( |
| 63 | + if (returnTypeFqn != null && PhpClassGeneratorUtil.isValidFqn(returnTypeFqn)) { |
| 64 | + final PhpReturnType returnType = PhpPsiElementFactory.createReturnType( |
64 | 65 | pluginMethod.getTargetMethod().getProject(), |
65 | 66 | returnTypeFqn |
66 | 67 | ); |
67 | | - } |
68 | 68 |
|
69 | | - if (returnType != null) { |
70 | | - resolver.processElement(returnType); |
| 69 | + if (returnType != null) { |
| 70 | + resolver.processElement(returnType); |
| 71 | + } |
71 | 72 | } |
72 | 73 |
|
73 | 74 | textBuf.append('\n'); |
|
0 commit comments