forked from KnpLabs/KnpUserBundle
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3033 from stof/fix_user_deprecation
Fix deprecation warning for UserInterface on Symfony 4
- Loading branch information
Showing
2 changed files
with
27 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,10 +14,31 @@ | |
use Symfony\Component\Security\Core\User\EquatableInterface; | ||
use Symfony\Component\Security\Core\User\UserInterface as BaseUserInterface; | ||
|
||
// This is required to support apps that explicitly check if a user is an instance of AdvancedUserInterface | ||
if (interface_exists('\Symfony\Component\Security\Core\User\AdvancedUserInterface')) { | ||
/** | ||
* @internal Only for back compatibility. Remove / merge when dropping support for Symfony 4 | ||
* | ||
* @deprecated | ||
*/ | ||
interface CompatUserInterface extends \Symfony\Component\Security\Core\User\AdvancedUserInterface | ||
{ | ||
} | ||
} else { | ||
/** | ||
* @internal Only for back compatibility. Remove / merge when dropping support for Symfony 4 | ||
*/ | ||
interface CompatUserInterface extends BaseUserInterface, EquatableInterface | ||
{ | ||
} | ||
} | ||
|
||
/** | ||
* @internal Only for back compatibility. Remove / merge when dropping support for Symfony 4 | ||
* @author Thibault Duplessis <[email protected]> | ||
* @author Johannes M. Schmitt <[email protected]> | ||
* @author Julian Finkler <[email protected]> | ||
*/ | ||
interface FosUserInterface extends \Serializable | ||
interface UserInterface extends CompatUserInterface, \Serializable | ||
{ | ||
public const ROLE_DEFAULT = 'ROLE_USER'; | ||
|
||
|
@@ -270,23 +291,3 @@ public function isCredentialsNonExpired(); | |
*/ | ||
public function isEnabled(); | ||
} | ||
|
||
// This is required to support apps that explicitly check if a user is an instance of AdvancedUserInterface | ||
if (interface_exists('\Symfony\Component\Security\Core\User\AdvancedUserInterface')) { | ||
/** | ||
* @author Thibault Duplessis <[email protected]> | ||
* @author Johannes M. Schmitt <[email protected]> | ||
*/ | ||
interface UserInterface extends FosUserInterface, \Symfony\Component\Security\Core\User\AdvancedUserInterface | ||
{ | ||
} | ||
} else { | ||
/** | ||
* @author Thibault Duplessis <[email protected]> | ||
* @author Johannes M. Schmitt <[email protected]> | ||
* @author Julian Finkler <[email protected]> | ||
*/ | ||
interface UserInterface extends FosUserInterface, BaseUserInterface, EquatableInterface | ||
{ | ||
} | ||
} |