Skip to content

Commit

Permalink
Check BackedEnum in the identifier callback directly
Browse files Browse the repository at this point in the history
  • Loading branch information
symfonyaml committed Jan 24, 2025
1 parent e4d6329 commit 4962e6c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,10 @@ final public static function getIdHashByIdentifier(array $identifier): string
' ',
array_map(
static function (mixed $value): Stringable|int|float|string|bool {
if ($value instanceof BackedEnum) {
$value = $value->value;
}

if (! is_scalar($value) && ! ($value instanceof Stringable)) {
throw new UnexpectedValueException(sprintf(
'Unexpected identifier value: Expecting scalar or Stringable, got %s.',
Expand Down

0 comments on commit 4962e6c

Please sign in to comment.