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

Appearance settings

Commit e6510a0

Browse filesBrowse files
committed
bug #41493 [Security] Readd deprecated methods to the interfaces (wouterj)
This PR was merged into the 5.3 branch. Discussion ---------- [Security] Readd deprecated methods to the interfaces | Q | A | ------------- | --- | Branch? | 5.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #41470 | License | MIT | Doc PR | n/a Readd the deprecated methods to the interface, to make sure third party packages <5.3 work with objects created using the 5.3+ interfaces. I've tested in a project and the deprecation is not triggered when implementing the method, only when calling. So this should still allow applications to be deprecation free in 5.4. Commits ------- b024656 [Security] Readd deprecated methods to the interfaces
2 parents 4d7d2a9 + b024656 commit e6510a0
Copy full SHA for e6510a0

File tree

6 files changed

+41
-0
lines changed
Filter options

6 files changed

+41
-0
lines changed

‎src/Symfony/Bridge/Doctrine/Security/User/UserLoaderInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Security/User/UserLoaderInterface.php
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,10 @@
2929
*/
3030
interface UserLoaderInterface
3131
{
32+
/**
33+
* @return UserInterface|null
34+
*
35+
* @deprecated since Symfony 5.3, use loadUserByIdentifier() instead
36+
*/
37+
public function loadUserByUsername(string $username);
3238
}

‎src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentTokenInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentTokenInterface.php
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,11 @@ public function getTokenValue();
4848
* @return \DateTime
4949
*/
5050
public function getLastUsed();
51+
52+
/**
53+
* @return string
54+
*
55+
* @deprecated since Symfony 5.3, use getUserIdentifier() instead
56+
*/
57+
public function getUsername();
5158
}

‎src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,11 @@ public function __serialize(): array;
130130
* Restores the object state from an array given by __serialize().
131131
*/
132132
public function __unserialize(array $data): void;
133+
134+
/**
135+
* @return string
136+
*
137+
* @deprecated since Symfony 5.3, use getUserIdentifier() instead
138+
*/
139+
public function getUsername();
133140
}

‎src/Symfony/Component/Security/Core/User/UserInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/User/UserInterface.php
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,11 @@ public function getSalt();
7878
* the plain-text password is stored on this object.
7979
*/
8080
public function eraseCredentials();
81+
82+
/**
83+
* @return string
84+
*
85+
* @deprecated since Symfony 5.3, use getUserIdentifier() instead
86+
*/
87+
public function getUsername();
8188
}

‎src/Symfony/Component/Security/Core/User/UserProviderInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/User/UserProviderInterface.php
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,13 @@ public function refreshUser(UserInterface $user);
5757
* @return bool
5858
*/
5959
public function supportsClass(string $class);
60+
61+
/**
62+
* @return UserInterface
63+
*
64+
* @throws UserNotFoundException
65+
*
66+
* @deprecated since Symfony 5.3, use loadUserByIdentifier() instead
67+
*/
68+
public function loadUserByUsername(string $username);
6069
}

‎src/Symfony/Component/Security/Http/Tests/LoginLink/LoginLinkHandlerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Tests/LoginLink/LoginLinkHandlerTest.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ public function createUser(TestLoginLinkHandlerUser $user): void
211211
$this->users[$user->getUserIdentifier()] = $user;
212212
}
213213

214+
public function loadUserByUsername($username): TestLoginLinkHandlerUser
215+
{
216+
return $this->loadUserByIdentifier($username);
217+
}
218+
214219
public function loadUserByIdentifier(string $userIdentifier): TestLoginLinkHandlerUser
215220
{
216221
if (!isset($this->users[$userIdentifier])) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.