public static @Nullable @NonNls String createPatternCaseText(PsiExpression expression){
    expression = PsiUtil.skipParenthesizedExprDown(expression);
    if (expression instanceof PsiInstanceOfExpression instanceOf) {
      final PsiPrimaryPattern pattern = instanceOf.getPattern();
      if (pattern != null) {
        if (pattern instanceof PsiDeconstructionPattern deconstruction && ErrorUtil.containsError(deconstruction.getDeconstructionList())) {
          return null;
        }
        return pattern.getText();
      }
      final PsiTypeElement typeElement = instanceOf.getCheckType();
      final PsiType type = typeElement != null ? typeElement.getType() : null;
      String name = new VariableNameGenerator(instanceOf, VariableKind.LOCAL_VARIABLE).byType(type).generate(true);
      String typeText = typeElement != null ? typeElement.getText() : CommonClassNames.JAVA_LANG_OBJECT;
      return typeText + " " + name;
    }
    if (expression instanceof PsiPolyadicExpression polyadicExpression) {
      String textWithPrimitives = getSwitchCaseTextWithComparedPrimitives(polyadicExpression);
      if (textWithPrimitives != null) return textWithPrimitives;
      final IElementType operationToken = polyadicExpression.getOperationTokenType();
      if (JavaTokenType.ANDAND.equals(operationToken)) {
        final PsiExpression[] operands = polyadicExpression.getOperands();
        final PsiExpression instanceOf = ContainerUtil.find(operands, operand -> operand instanceof PsiInstanceOfExpression);
        StringBuilder builder = new StringBuilder();
        builder.append(createPatternCaseText(instanceOf));
        boolean needAppendWhen = PsiUtil.isAvailable(JavaFeature.PATTERN_GUARDS_AND_RECORD_PATTERNS, expression);
        for (PsiExpression operand : operands) {
          if (operand != instanceOf) {
            builder.append(needAppendWhen ? " when " : " && ").append(operand.getText());
            needAppendWhen = false;
          }
        }
        return builder.toString();
      }
    }
    return null;
  }
public static @Nullable @NonNls String createPatternCaseText(PsiExpression expression)