Skip to content

Commit 09c3a0b

Browse files
committed
what if state hasn't changed?
1 parent 679d9ad commit 09c3a0b

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/Machine.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ public function getMachineState(): StateEnum
117117
*/
118118
protected function setMachineState(StateEnum $newState)
119119
{
120+
// just return if state doesn't change
121+
if ($this->machineState->is((string)$newState)) {
122+
return $this;
123+
}
120124

121125
if (false === $this->isTransitionAllowed($newState)) {
122126
throw new TransitionException('State transition from ' . (string)$this->getMachineState() . ' to ' . (string)$newState . ' is not allowed.');

0 commit comments

Comments
 (0)