Skip to content

Commit bb88d58

Browse files
Leverage PHP8's get_debug_type()
1 parent f74473e commit bb88d58

File tree

6 files changed

+6
-5
lines changed

6 files changed

+6
-5
lines changed

Authentication/AuthenticationProviderManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function authenticate(TokenInterface $token)
6565

6666
foreach ($this->providers as $provider) {
6767
if (!$provider instanceof AuthenticationProviderInterface) {
68-
throw new \InvalidArgumentException(sprintf('Provider "%s" must implement the AuthenticationProviderInterface.', \get_class($provider)));
68+
throw new \InvalidArgumentException(sprintf('Provider "%s" must implement the AuthenticationProviderInterface.', get_debug_type($provider)));
6969
}
7070

7171
if (!$provider->supports($token)) {

Authentication/Provider/RememberMeAuthenticationProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function authenticate(TokenInterface $token)
5252
$user = $token->getUser();
5353

5454
if (!$token->getUser() instanceof UserInterface) {
55-
throw new LogicException(sprintf('Method "%s::getUser()" must return a "%s" instance, "%s" returned.', \get_class($token), UserInterface::class, \is_object($user) ? \get_class($user) : \gettype($user)));
55+
throw new LogicException(sprintf('Method "%s::getUser()" must return a "%s" instance, "%s" returned.', get_debug_type($token), UserInterface::class, get_debug_type($user)));
5656
}
5757

5858
$this->userChecker->checkPreAuth($user);

Encoder/EncoderFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function getEncoder($user)
5050
}
5151

5252
if (null === $encoderKey) {
53-
throw new \RuntimeException(sprintf('No encoder has been configured for account "%s".', \is_object($user) ? \get_class($user) : $user));
53+
throw new \RuntimeException(sprintf('No encoder has been configured for account "%s".', \is_object($user) ? get_debug_type($user) : $user));
5454
}
5555

5656
if (!$this->encoders[$encoderKey] instanceof PasswordEncoderInterface) {

User/ChainUserProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function refreshUser(UserInterface $user)
9191
$e->setUsername($user->getUsername());
9292
throw $e;
9393
} else {
94-
throw new UnsupportedUserException(sprintf('There is no user provider for user "%s". Shouldn\'t the "supportsClass()" method of your user provider return true for this classname?', \get_class($user)));
94+
throw new UnsupportedUserException(sprintf('There is no user provider for user "%s". Shouldn\'t the "supportsClass()" method of your user provider return true for this classname?', get_debug_type($user)));
9595
}
9696
}
9797

User/InMemoryUserProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function loadUserByUsername(string $username)
7474
public function refreshUser(UserInterface $user)
7575
{
7676
if (!$user instanceof User) {
77-
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
77+
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_debug_type($user)));
7878
}
7979

8080
$storedUser = $this->getUser($user->getUsername());

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"require": {
1919
"php": "^7.2.5",
2020
"symfony/event-dispatcher-contracts": "^1.1|^2",
21+
"symfony/polyfill-php80": "^1.15",
2122
"symfony/service-contracts": "^1.1.6|^2",
2223
"symfony/deprecation-contracts": "^2.1"
2324
},

0 commit comments

Comments
 (0)