diff --git a/Security/Authenticator/ForwardCompatAuthenticatorTrait.php b/Security/Authenticator/ForwardCompatAuthenticatorTrait.php index bf8463e9..89264220 100644 --- a/Security/Authenticator/ForwardCompatAuthenticatorTrait.php +++ b/Security/Authenticator/ForwardCompatAuthenticatorTrait.php @@ -9,8 +9,9 @@ $r = new \ReflectionMethod(AuthenticatorInterface::class, 'authenticate'); -if ($r->hasReturnType() && Passport::class === $r->getReturnType()->getName()) { - eval(' +if (!trait_exists(ForwardCompatAuthenticatorTrait::class)) { + if ($r->hasReturnType() && Passport::class === $r->getReturnType()->getName()) { + eval(' namespace Lexik\Bundle\JWTAuthenticationBundle\Security\Authenticator; use Symfony\Component\HttpFoundation\Request; @@ -27,15 +28,16 @@ public function authenticate(Request $request): Passport } } '); -} else { - /** - * @internal - */ - trait ForwardCompatAuthenticatorTrait - { - public function authenticate(Request $request): PassportInterface + } else { + /** + * @internal + */ + trait ForwardCompatAuthenticatorTrait { - return $this->doAuthenticate($request); + public function authenticate(Request $request): PassportInterface + { + return $this->doAuthenticate($request); + } } } -} +} \ No newline at end of file