code: protected function checkInvoiceIntegrity(SaleItemInterface $item, SaleItem $constraint)
      {
          $sale = $item->getSale();
          if (!$sale instanceof Invoice\InvoiceSubjectInterface) {
              return;
          }
  
          if (empty($sale->getInvoices()->toArray())) {
              return;
          }
  
          $min = $this->invoiceCalculator->calculateInvoicedQuantity($item);
          $qty = $item->getTotalQuantity();
  
          // TODO Use packaging format
          if (1 === bccomp($min, 0, 3) && 1 === bccomp($min, $qty, 3)) {
              $this
                  ->context
                  ->buildViolation($constraint->quantity_is_lower_than_invoiced, [
                      '%min%' => $min,
                  ])
                  ->atPath('quantity')
                  ->addViolation();
  
              throw new ValidationFailedException();
          }
      }
docs: Checks that the sale item quantity is greater than or equals the invoiced quantity.
  
  @param SaleItemInterface $item
  @param SaleItem          $constraint
  
  @throws ValidationFailedException