Skip to content

Commit

Permalink
fix: key casting in context
Browse files Browse the repository at this point in the history
  • Loading branch information
mnavarrocarter committed Sep 22, 2023
1 parent 9733760 commit da834c2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions context/src/MissingContextValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ class MissingContextValue extends \LogicException
{
public static function forKey(mixed $key): MissingContextValue
{
if (is_object($key)) {
$key = get_class($key);
}

if (!is_string($key)) {
$key = (string) $key;
}

return new self(\sprintf('Missing context value for key "%s"', $key));
}
}

0 comments on commit da834c2

Please sign in to comment.