boolean (@NotNull PsiTypeElement startElement) { PsiElement parent = startElement.getParent(); if (parent instanceof PsiParameter psiParameter) { PsiElement declarationScope = psiParameter.getDeclarationScope(); if (declarationScope instanceof PsiLambdaExpression lambda) { return ContainerUtil.and(lambda.getParameterList().getParameters(), parameter -> VariableTypeCanBeExplicitInspection.getTypeElementToExpand(parameter) != null); } } if (parent instanceof PsiVariable variable) { return VariableTypeCanBeExplicitInspection.getTypeElementToExpand(variable) != null; } return false; }