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