List<PsiDeclarationStatement> (@NotNull List<? extends PsiLocalVariable> variables) { List<PsiDeclarationStatement> list = new ArrayList<>(); for (PsiLocalVariable var : variables) { PsiDeclarationStatement declarationStatement = PsiTreeUtil.getParentOfType(var, PsiDeclarationStatement.class); if(declarationStatement == null) return null; list.add(declarationStatement); } return list; }