vendor/league/oauth2-server-bundle/src/Security/Authenticator/ForwardCompatAuthenticatorTrait.php line 37

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