@Nullable
  private static PsiCodeBlock getVariableScopeBlock(@Nullable PsiVariable variable) {
    if (variable instanceof PsiLocalVariable localVar) {
      if (CommonJavaRefactoringUtil.getVariableScope(localVar) instanceof PsiCodeBlock block) {
        return block;
      }
    }
    else if (variable instanceof PsiParameter parameter) {
      final PsiElement parameterScope = parameter.getDeclarationScope();
      if (parameterScope instanceof PsiMethod method) {
        return method.getBody();
      }
      else if (parameterScope instanceof PsiLambdaExpression lambda && lambda.getBody() instanceof PsiCodeBlock block) {
        return block;
      }
    }
    return null;
  }
@Nullable
  private static PsiCodeBlock getVariableScopeBlock(@Nullable PsiVariable variable)