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