You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
minor #41640 [PasswordHasher] Add union types (ValentineBoineau)
This PR was merged into the 6.0 branch.
Discussion
----------
[PasswordHasher] Add union types
| Q | A
| ------------- | ---
| Branch? | 6.0
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Extracted from #41424
Commits
-------
8628479 [PasswordHasher] Add union types
if (!$userinstanceof PasswordAuthenticatedUserInterface) {
40
-
if (!$userinstanceof UserInterface) {
41
-
thrownew \TypeError(sprintf('Expected an instance of "%s" as first argument, but got "%s".', UserInterface::class, get_debug_type($user)));
42
-
}
43
-
trigger_deprecation('symfony/password-hasher', '5.3', 'The "%s()" method expects a "%s" instance as first argument. Not implementing it in class "%s" is deprecated.', __METHOD__, PasswordAuthenticatedUserInterface::class, get_debug_type($user));
44
-
}
45
-
46
-
$salt = $user->getSalt();
47
-
if ($salt && !$userinstanceof LegacyPasswordAuthenticatedUserInterface) {
48
-
trigger_deprecation('symfony/password-hasher', '5.3', 'Returning a string from "getSalt()" without implementing the "%s" interface is deprecated, the "%s" class should implement it.', LegacyPasswordAuthenticatedUserInterface::class, get_debug_type($user));
35
+
$salt = null;
36
+
if ($userinstanceof LegacyPasswordAuthenticatedUserInterface) {
if (!$userinstanceof PasswordAuthenticatedUserInterface) {
62
-
if (!$userinstanceof UserInterface) {
63
-
thrownew \TypeError(sprintf('Expected an instance of "%s" as first argument, but got "%s".', UserInterface::class, get_debug_type($user)));
64
-
}
65
-
trigger_deprecation('symfony/password-hasher', '5.3', 'The "%s()" method expects a "%s" instance as first argument. Not implementing it in class "%s" is deprecated.', __METHOD__, PasswordAuthenticatedUserInterface::class, get_debug_type($user));
66
-
}
67
-
68
-
$salt = $user->getSalt();
69
-
if ($salt && !$userinstanceof LegacyPasswordAuthenticatedUserInterface) {
70
-
trigger_deprecation('symfony/password-hasher', '5.3', 'Returning a string from "getSalt()" without implementing the "%s" interface is deprecated, the "%s" class should implement it.', LegacyPasswordAuthenticatedUserInterface::class, get_debug_type($user));
47
+
$salt = null;
48
+
if ($userinstanceof LegacyPasswordAuthenticatedUserInterface) {
49
+
$salt = $user->getSalt();
71
50
}
72
51
73
52
if (null === $user->getPassword()) {
@@ -79,22 +58,12 @@ public function isPasswordValid($user, string $plainPassword): bool
if (!$userinstanceof PasswordAuthenticatedUserInterface) {
92
-
if (!$userinstanceof UserInterface) {
93
-
thrownew \TypeError(sprintf('Expected an instance of "%s" as first argument, but got "%s".', UserInterface::class, get_debug_type($user)));
94
-
}
95
-
trigger_deprecation('symfony/password-hasher', '5.3', 'The "%s()" method expects a "%s" instance as first argument. Not implementing it in class "%s" is deprecated.', __METHOD__, PasswordAuthenticatedUserInterface::class, get_debug_type($user));
$this->expectDeprecation('Since symfony/password-hasher 5.3: Returning a string from "getSalt()" without implementing the "Symfony\Component\Security\Core\User\LegacyPasswordAuthenticatedUserInterface" interface is deprecated, the "%s" class should implement it.');
0 commit comments