8000 Improve invalid user provider exception message · symfony/symfony-docs@8556ae2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8556ae2

Browse files
mvarweaverryan
authored andcommitted
Improve invalid user provider exception message
1 parent 77fdbbe commit 8556ae2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cookbook/security/api_key_authentication.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ value and then a User object is created::
5858
{
5959
if (!$userProvider instanceof ApiKeyUserProvider) {
6060
throw new \InvalidArgumentException(
61-
'$userProvider must be an instance of "ApiKeyUserProvider".'
61+
sprintf(
62+
'The user provider must be an instance of ApiKeyUserProvider (%s was given).',
63+
get_class($userProvider)
64+
)
6265
);
6366
}
6467

@@ -507,7 +510,10 @@ to see if the stored token has a valid User object that can be used::
507510
{
508511
if (!$userProvider instanceof ApiKeyUserProvider) {
509512
throw new \InvalidArgumentException(
510-
'$userProvider must be an instance of "ApiKeyUserProvider".'
513+
sprintf(
514+
'The user provider must be an instance of ApiKeyUserProvider (%s was given).',
515+
get_class($userProvider)
516+
)
511517
);
512518
}
513519

0 commit comments

Comments
 (0)
0