code: protected function getAssignments($item)
      {
          if ($item instanceof ShipmentItemInterface) {
              $item = $item->getSaleItem();
          } elseif ($item instanceof InvoiceLineInterface) {
              if (!$item = $item->getSaleItem()) {
                  return null;
              }
          }
  
          if (!$this->supportsAssignment($item)) {
              return null;
          }
  
          return $item->getStockAssignments()->toArray();
      }
docs: Returns the item's stock assignments, or null if not supported.
  
  @param mixed $item
  
  @return null|StockAssignmentInterface[]