private void checkForForLoopParam(PsiExpression expression) {
      final PsiLocalVariable variable = ExpressionUtils.resolveLocalVariable(expression);
      if (variable == null) {
        return;
      }
      final PsiElement variableParent = variable.getParent();
      if (!(variableParent instanceof PsiDeclarationStatement declarationStatement)) {
        return;
      }
      final PsiElement parent = declarationStatement.getParent();
      if (!(parent instanceof PsiForStatement forStatement)) {
        return;
      }
      final PsiStatement initialization = forStatement.getInitialization();
      if (initialization == null ||
          !initialization.equals(declarationStatement) ||
          !isInForStatementBody(expression, forStatement) ||
          forStatement.getUpdate() == null) {
        return;
      }
      registerError(expression, Boolean.FALSE);
    }
private void checkForForLoopParam(PsiExpression expression)