private static @Nullable PsiExpression findPossiblePatternOperand(@Nullable PsiExpression expression) {
    if (expression instanceof PsiInstanceOfExpression psiInstanceOfExpression) {
      if (isUsedOutsideParentIf(psiInstanceOfExpression)) {
        return null;
      }
      return psiInstanceOfExpression.getOperand();
    }
    if (expression instanceof PsiPolyadicExpression polyadicExpression) {
      final IElementType operationToken = polyadicExpression.getOperationTokenType();
      final PsiExpression[] operands = polyadicExpression.getOperands();
      if (JavaTokenType.ANDAND.equals(operationToken)) {
        final PsiExpression patternOperand = findPossiblePatternOperand(operands[0]);
        if (patternOperand != null) return patternOperand;
        for (PsiExpression operand : operands) {
          final PsiExpression pattern = findPossiblePatternOperand(operand);
          if (pattern != null) return pattern;
          if (SideEffectChecker.mayHaveSideEffects(operand)) break;
        }
      }
    }
    return null;
  }
private static @Nullable PsiExpression findPossiblePatternOperand(@Nullable PsiExpression expression)