Change record status: 
Project: 
Introduced in branch: 
8.x-1.x
Introduced in version: 
8.x-1.3
Description: 

Applying an invalid transition via the applyTransition() or applyTransitionById()methods will throw an InvalidArgumentException exception from now on.

Before applying any transition, one must ensure the transition about to be applied is "allowed" by calling the isTransitionAllowed() method, like the following:

  $state_item = $entity->get('field_state')->first();
  // Where 'foo' is the $transition_id.
  if ($state_item->isTransitionAllowed('foo') {
   $state_item->applyTransitionById('foo');
  }
Impacts: 
Module developers