ChainExpressionModel (@NotNull PsiStatement chainStatement, @NotNull PsiExpression chainExpression) { PsiReturnStatement returnStatement = tryCast(chainStatement, PsiReturnStatement.class); if (returnStatement != null) return ChainReturn.create(returnStatement, chainExpression); PsiAssignmentExpression assignment = ExpressionUtils.getAssignment(chainStatement); if (assignment != null) return ChainAssignment.create(assignment, chainExpression); PsiDeclarationStatement declaration = tryCast(chainStatement, PsiDeclarationStatement.class); if (declaration != null) return ChainDeclaration.create(declaration, chainExpression); PsiExpressionStatement expressionStatement = tryCast(chainStatement, PsiExpressionStatement.class); if (expressionStatement != null && PsiUtil.skipParenthesizedExprDown(expressionStatement.getExpression()) == chainExpression) { return new ChainStatement(); } return null; }