Backup #806
| ID | 806 |
| Dateipfad | /var/www/dev.campus.systemische-tools.de/src/Domain/Exception/InvalidStateTransitionException.php |
| Version | 1 |
| Typ |
modified |
| Größe | 1.3 KB |
| Hash | e47ea3cdabf46c6f0cf17ce8d626d312a700f13b7da32f806ad2ae40ecdf725a |
| Datum | 2025-12-23 08:07:54 |
| Geändert von | claude-code-hook |
| Grund | Claude Code Pre-Hook Backup vor Edit-Operation |
| Datei existiert |
Ja
|
Dateiinhalt
<?php
namespace Domain\Exception;
use BackedEnum;
use DomainException;
/**
* Exception thrown when an invalid state transition is attempted.
*/
final class InvalidStateTransitionException extends DomainException
{
/**
* @param BackedEnum $from Current status
* @param BackedEnum $to Target status
* @param array<BackedEnum> $allowed Allowed transitions from current status
*/
public function __construct(
public readonly BackedEnum $from,
public readonly BackedEnum $to,
public readonly array $allowed
) {
$allowedValues = array_map(
static fn (BackedEnum $s): string => (string) $s->value,
$allowed
);
$message = sprintf(
'Ungültiger Statusübergang von "%s" nach "%s". Erlaubt: %s',
$from->value,
$to->value,
$allowedValues !== [] ? implode(', ', $allowedValues) : 'keine'
);
parent::__construct($message);
}
/**
* Get allowed transition values as strings.
*
* @return array<string>
*/
public function getAllowedValues(): array
{
return array_map(
static fn (BackedEnum $s): string => (string) $s->value,
$this->allowed
);
}
}
Vollständig herunterladen
Aktionen
← Zurück zur Übersicht