{
"event": "PreToolUse",
"tool_name": "Write",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Domain\/Exception\/InvalidStateTransitionException.php",
"content": "<?php\n\nnamespace Domain\\Exception;\n\nuse BackedEnum;\nuse DomainException;\n\n\/**\n * Exception thrown when an invalid state transition is attempted.\n *\/\nfinal class InvalidStateTransitionException extends DomainException\n{\n \/**\n * @param BackedEnum $from Current status\n * @param BackedEnum $to Target status\n * @param array<BackedEnum> $allowed Allowed transitions from current status\n *\/\n public function __construct(\n public readonly BackedEnum $from,\n public readonly BackedEnum $to,\n public readonly array $allowed\n ) {\n $allowedValues = array_map(\n static fn (BackedEnum $s): string => (string) $s->value,\n $allowed\n );\n\n $message = sprintf(\n 'Ungültiger Statusübergang von \"%s\" nach \"%s\". Erlaubt: %s',\n $from->value,\n $to->value,\n $allowedValues !== [] ? implode(', ', $allowedValues) : 'keine'\n );\n\n parent::__construct($message);\n }\n\n \/**\n * Get allowed transition values as strings.\n *\n * @return array<string>\n *\/\n public function getAllowedValues(): array\n {\n return array_map(\n static fn (BackedEnum $s): string => (string) $s->value,\n $this->allowed\n );\n }\n}\n"
}
}
{
"tool_response": {
"type": "create",
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Domain\/Exception\/InvalidStateTransitionException.php",
"content": "<?php\n\nnamespace Domain\\Exception;\n\nuse BackedEnum;\nuse DomainException;\n\n\/**\n * Exception thrown when an invalid state transition is attempted.\n *\/\nfinal class InvalidStateTransitionException extends DomainException\n{\n \/**\n * @param BackedEnum $from Current status\n * @param BackedEnum $to Target status\n * @param array<BackedEnum> $allowed Allowed transitions from current status\n *\/\n public function __construct(\n public readonly BackedEnum $from,\n public readonly BackedEnum $to,\n public readonly array $allowed\n ) {\n $allowedValues = array_map(\n static fn (BackedEnum $s): string => (string) $s->value,\n $allowed\n );\n\n $message = sprintf(\n 'Ungültiger Statusübergang von \"%s\" nach \"%s\". Erlaubt: %s',\n $from->value,\n $to->value,\n $allowedValues !== [] ? implode(', ', $allowedValues) : 'keine'\n );\n\n parent::__construct($message);\n }\n\n \/**\n * Get allowed transition values as strings.\n *\n * @return array<string>\n *\/\n public function getAllowedValues(): array\n {\n return array_map(\n static fn (BackedEnum $s): string => (string) $s->value,\n $this->allowed\n );\n }\n}\n",
"structuredPatch": [],
"originalFile": null
}
}