Skip to content

Commit

Permalink
Add support for enums in error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen authored Nov 19, 2024
1 parent d395960 commit 02b4994
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/SAML11/Assert/Assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
use function array_unshift;
use function call_user_func_array;
use function end;
use function enum_exists;
use function function_exists;
use function get_class;
use function is_object;
use function is_resource;
use function is_string;
Expand Down Expand Up @@ -159,6 +162,10 @@ protected static function valueToString(mixed $value): string
return $value::class . ': ' . self::valueToString($value->format('c'));
}

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

return $value::class;
}

Expand Down

0 comments on commit 02b4994

Please sign in to comment.