/**
  * {@inheritdoc}
  */
 public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b)
 {
     // Sort the entities using the entity class's sort() method.
     // See \Drupal\Core\Config\Entity\ConfigEntityBase::sort().
     /* @var $a WorkflowTransitionInterface */
     /* @var $b WorkflowTransitionInterface */
     if (!$a->getFromSid() || !$b->getFromSid()) {
         return 0;
     }
     // First sort on From-State.
     $from_state_a = $a->getFromState();
     $from_state_b = $b->getFromState();
     if ($from_state_a->weight < $from_state_b->weight) {
         return -1;
     }
     if ($from_state_a->weight > $from_state_b->weight) {
         return +1;
     }
     // Then sort on To-State.
     $to_state_a = $a->getToState();
     $to_state_b = $b->getToState();
     if ($to_state_a->weight < $to_state_b->weight) {
         return -1;
     }
     if ($to_state_a->weight > $to_state_b->weight) {
         return +1;
     }
     return 0;
 }