{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Traits\/JsonDecodeTrait.php",
"old_string": "<?php\n\nnamespace Infrastructure\\Traits;\n\n\/**\n * Trait for safe JSON decoding with default empty array.\n * Use in non-Controller classes that need JSON parsing.\n *\/\ntrait JsonDecodeTrait",
"new_string": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Infrastructure\\Traits;\n\n\/\/ @responsibility: Sichere JSON-Dekodierung mit Fallback auf leeres Array\n\ntrait JsonDecodeTrait"
}
}
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Traits\/JsonDecodeTrait.php",
"oldString": "<?php\n\nnamespace Infrastructure\\Traits;\n\n\/**\n * Trait for safe JSON decoding with default empty array.\n * Use in non-Controller classes that need JSON parsing.\n *\/\ntrait JsonDecodeTrait",
"newString": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Infrastructure\\Traits;\n\n\/\/ @responsibility: Sichere JSON-Dekodierung mit Fallback auf leeres Array\n\ntrait JsonDecodeTrait",
"originalFile": "<?php\n\nnamespace Infrastructure\\Traits;\n\n\/**\n * Trait for safe JSON decoding with default empty array.\n * Use in non-Controller classes that need JSON parsing.\n *\/\ntrait JsonDecodeTrait\n{\n \/**\n * Decode JSON string to array with safe defaults.\n *\n * @return array<mixed>\n *\/\n protected function decodeJsonArray(?string $json): array\n {\n if ($json === null || $json === '') {\n return [];\n }\n\n $decoded = json_decode($json, true);\n\n return is_array($decoded) ? $decoded : [];\n }\n}\n",
"structuredPatch": [
{
"oldStart": 1,
"oldLines": 11,
"newStart": 1,
"newLines": 11,
"lines": [
" <?php",
" ",
"+declare(strict_types=1);",
"+",
" namespace Infrastructure\\Traits;",
" ",
"-\/**",
"- * Trait for safe JSON decoding with default empty array.",
"- * Use in non-Controller classes that need JSON parsing.",
"- *\/",
"+\/\/ @responsibility: Sichere JSON-Dekodierung mit Fallback auf leeres Array",
"+",
" trait JsonDecodeTrait",
" {",
" \/**"
]
}
],
"userModified": false,
"replaceAll": false
}
}