|
8 | 8 | import com.intellij.openapi.util.Key; |
9 | 9 | import com.intellij.psi.PsiElement; |
10 | 10 | import com.jetbrains.php.lang.documentation.phpdoc.psi.PhpDocComment; |
| 11 | +import com.jetbrains.php.lang.psi.PhpPsiElementFactory; |
11 | 12 | import com.jetbrains.php.lang.psi.elements.Method; |
12 | 13 | import com.jetbrains.php.lang.psi.elements.Parameter; |
13 | 14 | import com.jetbrains.php.lang.psi.elements.PhpReturnType; |
14 | 15 | import com.magento.idea.magento2plugin.actions.generation.data.code.PluginMethodData; |
15 | 16 | import com.magento.idea.magento2plugin.actions.generation.references.PhpClassReferenceResolver; |
| 17 | +import com.magento.idea.magento2plugin.util.php.PhpTypeMetadataParserUtil; |
16 | 18 | import java.util.ArrayList; |
17 | 19 | import java.util.Arrays; |
18 | 20 | import java.util.Collection; |
@@ -53,7 +55,17 @@ public void execute( |
53 | 55 | final PsiElement targetClass = (PsiElement) pluginMethod.getTargetMethod() |
54 | 56 | .getUserData(targetClassKey); |
55 | 57 | resolver.processElement(targetClass); |
56 | | - final PhpReturnType returnType = targetMethod.getReturnType(); |
| 58 | + PhpReturnType returnType = targetMethod.getReturnType(); |
| 59 | + final String returnTypeFqn = |
| 60 | + PhpTypeMetadataParserUtil.getMethodReturnType(targetMethod); |
| 61 | + |
| 62 | + if (returnType == null && returnTypeFqn != null) { |
| 63 | + returnType = PhpPsiElementFactory.createReturnType( |
| 64 | + pluginMethod.getTargetMethod().getProject(), |
| 65 | + returnTypeFqn |
| 66 | + ); |
| 67 | + } |
| 68 | + |
57 | 69 | if (returnType != null) { |
58 | 70 | resolver.processElement(returnType); |
59 | 71 | } |
|
0 commit comments