$nextStepIds) { $stepMap[$id] = $this->createStep($id, 'test-type', $nextStepIds); } return $this->make(Automation::class, ['getSteps' => $stepMap]); } public function createStep(string $id, string $type = 'test-type', array $nextStepIds = []): Step { $nextSteps = array_map(function (string $id) { return new NextStep($id); }, $nextStepIds); return new Step($id, $type, 'test-key', [], $nextSteps); } }