code: protected function sortAssignments(array $assignments)
      {
          usort($assignments, function (StockAssignmentInterface $a1, StockAssignmentInterface $a2) {
              $u1 = $a1->getStockUnit();
              $u2 = $a2->getStockUnit();
  
              return $this->compareStockUnit($u1, $u2);
          });
  
          return $assignments;
      }
docs: Sorts assignments.
  
  @param array $assignments
  
  @return array