nextId(); $plan = new Plan( id: $id, name: $dto->name, ); $this->existingPlans[$id] = $plan; return $plan; } private function nextId(): int { return count($this->existingPlans); } }