Skip to content

Commit

Permalink
Add support for enums in error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitriy Gordinskiy authored and gordinskiy committed Oct 18, 2024
1 parent c4c6fb8 commit 4dd4336
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -2087,6 +2087,10 @@ protected static function valueToString($value)
return \get_class($value).': '.self::valueToString($value->format('c'));
}

if (\function_exists('enum_exists') && \enum_exists(\get_class($value))) {
return \get_class($value).'::'.$value->name;
}

return \get_class($value);
}

Expand Down

0 comments on commit 4dd4336

Please sign in to comment.