vendor/lexik/jwt-authentication-bundle/Security/Authenticator/ForwardCompatAuthenticatorTrait.php line 39

Open in your IDE?
  1. <?php
  2. namespace Lexik\Bundle\JWTAuthenticationBundle\Security\Authenticator;
  3. use Symfony\Component\HttpFoundation\Request;
  4. use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
  5. use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
  6. use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface;
  7. $r = new \ReflectionMethod(AuthenticatorInterface::class, 'authenticate');
  8. if (!trait_exists(ForwardCompatAuthenticatorTrait::class)) {
  9.     if ($r->hasReturnType() && Passport::class === $r->getReturnType()->getName()) {
  10.         eval('
  11.         namespace Lexik\Bundle\JWTAuthenticationBundle\Security\Authenticator;
  12.         
  13.         use Symfony\Component\HttpFoundation\Request;
  14.         use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
  15.         /**
  16.          * @internal
  17.          */
  18.         trait ForwardCompatAuthenticatorTrait
  19.         {
  20.             public function authenticate(Request $request): Passport
  21.             {
  22.                 return $this->doAuthenticate($request);
  23.             }
  24.         }
  25.     ');
  26.     } else {
  27.         /**
  28.          * @internal
  29.          */
  30.         trait ForwardCompatAuthenticatorTrait
  31.         {
  32.             public function authenticate(Request $request): PassportInterface
  33.             {
  34.                 return $this->doAuthenticate($request);
  35.             }
  36.         }
  37.     }
  38. }