Closed
Description
Description
Currently it is possible to instantiate an "invalid" StateMachine. It would be nice to have some checks in place to prevent this.
Example
For example:
<?php
use Symfony\Component\Workflow\Definition;
use Symfony\Component\Workflow\StateMachine;
use Symfony\Component\Workflow\Transition;
$states = ['created', 'activated', 'deleted'];
$stateTransitions = [
new Transition('activate', 'created', 'activated'),
new Transition('activate', 'created', 'deleted'), //oops, copy-paste mistake: 'activate' should have been 'delete'
];
$definition = new Definition($states, $stateTransitions);
$stateMachine = new StateMachine($definition);
This would result in an "invalid" StateMachine...
Maybe some inspiration can be derived from this implementation of a StateMachine