File tree Expand file tree Collapse file tree
src/M6Web/Bundle/LogBridgeBundle Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,7 +127,8 @@ protected function getUsername(): string
127127 }
128128
129129 // compatibility Symfony < 6
130- if (method_exists ($ token , 'getUsername ' )) {
130+ if (!method_exists ($ token , 'getUserIdentifier ' ) &&
131+ method_exists ($ token , 'getUsername ' )) {
131132 return $ token ->getUsername ();
132133 }
133134
Original file line number Diff line number Diff line change @@ -31,7 +31,8 @@ private function getUser(): UserInterface
3131 private function getMockedToken ()
3232 {
3333 $ usernameMethod = 'getUserIdentifier ' ;
34- if (method_exists (\Symfony \Component \Security \Core \Authentication \Token \TokenInterface::class, 'getUsername ' )) {
34+ if (!method_exists (\Symfony \Component \Security \Core \Authentication \Token \TokenInterface::class, $ usernameMethod ) &&
35+ method_exists (\Symfony \Component \Security \Core \Authentication \Token \TokenInterface::class, 'getUsername ' )) {
3536 // compatibility Symfony < 6
3637 $ usernameMethod = 'getUsername ' ;
3738 }
Original file line number Diff line number Diff line change @@ -38,7 +38,8 @@ private function getUser(): UserInterface
3838 private function getMockedToken ()
3939 {
4040 $ usernameMethod = 'getUserIdentifier ' ;
41- if (method_exists (\Symfony \Component \Security \Core \Authentication \Token \TokenInterface::class, 'getUsername ' )) {
41+ if (!method_exists (\Symfony \Component \Security \Core \Authentication \Token \TokenInterface::class, $ usernameMethod ) &&
42+ method_exists (\Symfony \Component \Security \Core \Authentication \Token \TokenInterface::class, 'getUsername ' )) {
4243 // compatibility Symfony < 6
4344 $ usernameMethod = 'getUsername ' ;
4445 }
You can’t perform that action at this time.
0 commit comments