Skip to content

Commit

Permalink
feature #7 Symfony 6 User needs to implement PasswordAuthenticatedUse…
Browse files Browse the repository at this point in the history
…rInterface (Zales0123)

This PR was merged into the 1.0-dev branch.

Discussion
----------

It's kinda BC break, as the `getPassword()` method has `?string` return type defined, but I'm not sure we can avoid it 🤷‍♂️ 

Commits
-------

d401b81 Symfony 6 User needs to implement PasswordAuthenticatedUserInterface
  • Loading branch information
GSadee authored Sep 27, 2022
2 parents aea1494 + d401b81 commit ed488dd
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions src/Core/User/UserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,22 @@

namespace SyliusLabs\Polyfill\Symfony\Security\Core\User;

use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface as SymfonyUserInterface;

// Symfony 5.4
if (\method_exists(SymfonyUserInterface::class, 'getPassword')) {
interface UserInterface extends SymfonyUserInterface
{
}
// Symfony 6
} else {
/**
* @link https://github.com/symfony/symfony/blob/5.3/src/Symfony/Component/Security/Core/User/UserInterface.php
* @link https://github.com/symfony/symfony/blob/6.0/src/Symfony/Component/Security/Core/User/UserInterface.php
* @link https://github.com/symfony/symfony/blob/6.0/src/Symfony/Component/Security/Core/User/PasswordAuthenticatedUserInterface.php
*/
interface UserInterface extends SymfonyUserInterface
interface UserInterface extends SymfonyUserInterface, PasswordAuthenticatedUserInterface
{
/**
* Returns the password used to authenticate the user.
*
* This should be the hashed password. On authentication, a plain-text
* password will be hashed, and then compared to this value.
*
* This method is deprecated since Symfony 5.3, implement it from {@link PasswordAuthenticatedUserInterface} instead.
*
* @return string|null The hashed password if any
*/
public function getPassword();

/**
* Returns the salt that was originally used to hash the password.
*
Expand Down

0 comments on commit ed488dd

Please sign in to comment.