Skip to content

Commit 10c882f

Browse files
committed
Prepare PasswordUpgraderInterface implementations for 6.0 signatures
1 parent ec841f7 commit 10c882f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Security/User/EntityUserProvider.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,14 @@ public function supportsClass(string $class)
133133
*
134134
* @final
135135
*/
136-
public function upgradePassword(UserInterface $user, string $newEncodedPassword): void
136+
public function upgradePassword($user, string $newHashedPassword): void
137137
{
138138
if (!$user instanceof PasswordAuthenticatedUserInterface) {
139139
trigger_deprecation('symfony/doctrine-bridge', '5.3', 'The "%s::upgradePassword()" method expects an instance of "%s" as first argument, the "%s" class should implement it.', PasswordUpgraderInterface::class, PasswordAuthenticatedUserInterface::class, get_debug_type($user));
140+
141+
if (!$user instanceof UserInterface) {
142+
throw new \TypeError(sprintf('The "%s::upgradePassword()" method expects an instance of "%s" as first argument, "%s" given.', PasswordAuthenticatedUserInterface::class, get_debug_type($user)));
143+
}
140144
}
141145

142146
$class = $this->getClass();
@@ -146,7 +150,7 @@ public function upgradePassword(UserInterface $user, string $newEncodedPassword)
146150

147151
$repository = $this->getRepository();
148152
if ($repository instanceof PasswordUpgraderInterface) {
149-
$repository->upgradePassword($user, $newEncodedPassword);
153+
$repository->upgradePassword($user, $newHashedPassword);
150154
}
151155
}
152156

0 commit comments

Comments
 (0)