Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfe3fdfd

Browse files
[PasswordHasher] Add union types
1 parentf4ded44 commitfe3fdfd

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

‎src/Symfony/Component/PasswordHasher/Hasher/PasswordHasherFactory.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
useSymfony\Component\Security\Core\Encoder\EncoderAwareInterface;
1717
useSymfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
1818
useSymfony\Component\Security\Core\Encoder\PasswordHasherAdapter;
19+
useSymfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
20+
useSymfony\Component\Security\Core\User\UserInterface;
1921

2022
/**
2123
* A generic hasher factory implementation.
@@ -38,7 +40,7 @@ public function __construct(array $passwordHashers)
3840
/**
3941
* {@inheritdoc}
4042
*/
41-
publicfunctiongetPasswordHasher($user):PasswordHasherInterface
43+
publicfunctiongetPasswordHasher(UserInterface|string|PasswordAuthenticatedUserInterface$user):PasswordHasherInterface
4244
{
4345
$hasherKey =null;
4446

‎src/Symfony/Component/PasswordHasher/Hasher/PasswordHasherFactoryInterface.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ interface PasswordHasherFactoryInterface
2626
/**
2727
* Returns the password hasher to use for the given user.
2828
*
29-
* @param PasswordAuthenticatedUserInterface|UserInterface|string $user A PasswordAuthenticatedUserInterface/UserInterface instance or a class name
29+
* @paramstring|PasswordAuthenticatedUserInterface|UserInterface $user A PasswordAuthenticatedUserInterface/UserInterface instance or a class name
3030
*
3131
* @throws \RuntimeException When no password hasher could be found for the user
3232
*/
33-
publicfunctiongetPasswordHasher($user):PasswordHasherInterface;
33+
publicfunctiongetPasswordHasher(UserInterface|string|PasswordAuthenticatedUserInterface$user):PasswordHasherInterface;
3434
}

‎src/Symfony/Component/PasswordHasher/Hasher/UserPasswordHasher.php‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ public function __construct(PasswordHasherFactoryInterface $hasherFactory)
3131
$this->hasherFactory =$hasherFactory;
3232
}
3333

34-
/**
35-
* @param PasswordAuthenticatedUserInterface $user
36-
*/
37-
publicfunctionhashPassword($user,string$plainPassword):string
34+
publicfunctionhashPassword(UserInterface|string|PasswordAuthenticatedUserInterface$user,string$plainPassword):string
3835
{
3936
if (!$userinstanceof PasswordAuthenticatedUserInterface) {
4037
if (!$userinstanceof UserInterface) {
@@ -53,10 +50,7 @@ public function hashPassword($user, string $plainPassword): string
5350
return$hasher->hash($plainPassword,$salt);
5451
}
5552

56-
/**
57-
* @param PasswordAuthenticatedUserInterface $user
58-
*/
59-
publicfunctionisPasswordValid($user,string$plainPassword):bool
53+
publicfunctionisPasswordValid(UserInterface|string|PasswordAuthenticatedUserInterface$user,string$plainPassword):bool
6054
{
6155
if (!$userinstanceof PasswordAuthenticatedUserInterface) {
6256
if (!$userinstanceof UserInterface) {
@@ -79,10 +73,7 @@ public function isPasswordValid($user, string $plainPassword): bool
7973
return$hasher->verify($user->getPassword(),$plainPassword,$salt);
8074
}
8175

82-
/**
83-
* @param PasswordAuthenticatedUserInterface $user
84-
*/
85-
publicfunctionneedsRehash($user):bool
76+
publicfunctionneedsRehash(UserInterface|string|PasswordAuthenticatedUserInterface$user):bool
8677
{
8778
if (null ===$user->getPassword()) {
8879
returnfalse;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp