{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Task\/CreateTaskUseCase.php",
"old_string": " public function execute(array $data): Task",
"new_string": " \/** @param array<string, mixed> $data *\/\n public function execute(array $data): Task"
}
}
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Task\/CreateTaskUseCase.php",
"oldString": " public function execute(array $data): Task",
"newString": " \/** @param array<string, mixed> $data *\/\n public function execute(array $data): Task",
"originalFile": "<?php\n\ndeclare(strict_types=1);\n\nnamespace UseCases\\Task;\n\n\/\/ @responsibility: Erstellt neue Tasks mit optionalen Kommentaren und Parent-Verknüpfung\n\nuse Domain\\Entity\\Task;\nuse Domain\\Entity\\TaskComment;\nuse Domain\\Repository\\TaskRepositoryInterface;\nuse Domain\\ValueObject\\TaskType;\nuse Infrastructure\\Persistence\\TaskCommentRepository;\n\nclass CreateTaskUseCase\n{\n public function __construct(\n private TaskRepositoryInterface $taskRepository,\n private TaskCommentRepository $commentRepository\n ) {\n }\n\n public function execute(array $data): Task\n {\n $this->validate($data);\n\n $task = Task::create(\n $data['title'],\n $data['created_by'] ?? 'system',\n $data['description'] ?? null,\n isset($data['type']) ? TaskType::from($data['type']) : null,\n isset($data['parent_task_id']) ? (int) $data['parent_task_id'] : null,\n isset($data['due_date']) ? new \\DateTimeImmutable($data['due_date']) : null\n );\n\n if (isset($data['metadata'])) {\n $task->updateMetadata($data['metadata']);\n }\n\n $id = $this->taskRepository->save($task);\n $task->setId($id);\n\n $comment = new TaskComment();\n $comment->setTaskId($id);\n $comment->setAuthor($task->getCreatedBy());\n $comment->setAuthorType($task->getCreatedByType());\n $comment->setCommentType('note');\n $comment->setContent('Task erstellt');\n $this->commentRepository->save($comment);\n\n return $task;\n }\n\n private function validate(array $data): void\n {\n if (!isset($data['title']) || $data['title'] === '') {\n throw new \\InvalidArgumentException('Title is required');\n }\n\n if (strlen($data['title']) > 255) {\n throw new \\InvalidArgumentException('Title must be 255 characters or less');\n }\n\n if (isset($data['type']) && !in_array($data['type'], ['human_task', 'ai_task', 'mixed'])) {\n throw new \\InvalidArgumentException('Invalid task type');\n }\n }\n}\n",
"structuredPatch": [
{
"oldStart": 20,
"oldLines": 6,
"newStart": 20,
"newLines": 7,
"lines": [
" ) {",
" }",
" ",
"+ \/** @param array<string, mixed> $data *\/",
" public function execute(array $data): Task",
" {",
" $this->validate($data);"
]
}
],
"userModified": false,
"replaceAll": false
}
}