public function createEvent(StateInterface $sourceState, $eventName) { if ($sourceState instanceof State) { return $sourceState->getEvent($eventName); } else { throw new \InvalidArgumentException('Overwrite this method to implement a different type!'); } }