PsiTypeCastExpression (@NotNull PsiMethodCallExpression call) { while (true) { if (!call.getArgumentList().isEmpty()) return null; PsiExpression qualifier = PsiUtil.skipParenthesizedExprDown(call.getMethodExpression().getQualifierExpression()); PsiMethodCallExpression qualifierMethodCall = ObjectUtils.tryCast(qualifier, PsiMethodCallExpression.class); if (qualifierMethodCall == null) return ObjectUtils.tryCast(qualifier, PsiTypeCastExpression.class); call = qualifierMethodCall; } }