boolean (PsiStatement statement) { if (!(statement instanceof PsiDeclarationStatement declarationStatement)) { return false; } final PsiElement[] declaredElements = declarationStatement.getDeclaredElements(); if (declaredElements.length != 1) { return false; } final PsiElement element = declaredElements[0]; if (!(element instanceof PsiLocalVariable variable)) { return false; } final PsiExpression initializer = PsiUtil.skipParenthesizedExprDown(variable.getInitializer()); if (initializer == null || initializer instanceof PsiLiteralExpression) { return false; } final PsiType type = initializer.getType(); return PsiTypes.booleanType().equals(type); }