getStep(); $parents = $node->getParents(); $parentIdsMap = array_combine( array_map(function (Step $parent) { return $parent->getId(); }, $node->getParents()), $parents ) ?: []; foreach ($step->getNextSteps() as $nextStep) { $nextStepId = $nextStep->getId(); if ($nextStepId === $step->getId() || isset($parentIdsMap[$nextStepId])) { throw Exceptions::workflowStructureNotValid(__('Cycle found in workflow graph', 'mailpoet'), self::RULE_ID); } } } public function complete(Workflow $workflow): void { } }