Skip to content

Commit af4b9c0

Browse files
committed
1035: removed deprecated Function#getReturnType
1 parent 05e394f commit af4b9c0

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/com/magento/idea/magento2plugin/actions/generation/util/FillTextBufferWithPluginMethods.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.jetbrains.php.lang.psi.elements.Parameter;
1414
import com.jetbrains.php.lang.psi.elements.PhpReturnType;
1515
import com.magento.idea.magento2plugin.actions.generation.data.code.PluginMethodData;
16+
import com.magento.idea.magento2plugin.actions.generation.generator.util.PhpClassGeneratorUtil;
1617
import com.magento.idea.magento2plugin.actions.generation.references.PhpClassReferenceResolver;
1718
import com.magento.idea.magento2plugin.util.php.PhpTypeMetadataParserUtil;
1819
import java.util.ArrayList;
@@ -55,19 +56,19 @@ public void execute(
5556
final PsiElement targetClass = (PsiElement) pluginMethod.getTargetMethod()
5657
.getUserData(targetClassKey);
5758
resolver.processElement(targetClass);
58-
PhpReturnType returnType = targetMethod.getReturnType();
59+
5960
final String returnTypeFqn =
6061
PhpTypeMetadataParserUtil.getMethodReturnType(targetMethod);
6162

62-
if (returnType == null && returnTypeFqn != null) {
63-
returnType = PhpPsiElementFactory.createReturnType(
63+
if (returnTypeFqn != null && PhpClassGeneratorUtil.isValidFqn(returnTypeFqn)) {
64+
final PhpReturnType returnType = PhpPsiElementFactory.createReturnType(
6465
pluginMethod.getTargetMethod().getProject(),
6566
returnTypeFqn
6667
);
67-
}
6868

69-
if (returnType != null) {
70-
resolver.processElement(returnType);
69+
if (returnType != null) {
70+
resolver.processElement(returnType);
71+
}
7172
}
7273

7374
textBuf.append('\n');

0 commit comments

Comments
 (0)