From c3a4670c1103137df1269e547d2ef460f1e2308f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Unger?= Date: Sat, 9 Jul 2016 01:00:44 +0200 Subject: [PATCH] Updated PHPDoc --- src/AuthorizationServer.php | 55 ++++++------ .../BearerTokenValidator.php | 6 +- src/CryptKey.php | 3 +- src/CryptTrait.php | 11 ++- src/Entities/AccessTokenEntityInterface.php | 2 +- src/Entities/RefreshTokenEntityInterface.php | 4 +- src/Entities/TokenInterface.php | 4 +- src/Entities/Traits/AccessTokenTrait.php | 2 +- src/Entities/Traits/ClientTrait.php | 6 ++ src/Entities/Traits/RefreshTokenTrait.php | 9 +- src/Entities/Traits/TokenEntityTrait.php | 13 ++- src/Exception/OAuthServerException.php | 15 ++-- src/Grant/AbstractGrant.php | 88 +++++++++++-------- src/Grant/AuthCodeGrant.php | 23 +++-- src/Grant/ClientCredentialsGrant.php | 1 + src/Grant/GrantTypeInterface.php | 29 +++--- src/Grant/ImplicitGrant.php | 14 +-- src/Grant/PasswordGrant.php | 13 +-- src/Grant/RefreshTokenGrant.php | 9 +- .../AuthorizationServerMiddleware.php | 14 ++- src/Middleware/ResourceServerMiddleware.php | 12 ++- .../AccessTokenRepositoryInterface.php | 9 +- .../AuthCodeRepositoryInterface.php | 5 +- .../ClientRepositoryInterface.php | 7 +- .../RefreshTokenRepositoryInterface.php | 3 +- src/Repositories/RepositoryInterface.php | 1 + src/Repositories/ScopeRepositoryInterface.php | 12 +-- src/Repositories/UserRepositoryInterface.php | 11 +-- src/RequestEvent.php | 7 +- src/RequestTypes/AuthorizationRequest.php | 6 +- src/ResourceServer.php | 24 ++--- src/ResponseTypes/AbstractResponseType.php | 5 +- src/ResponseTypes/BearerTokenResponse.php | 3 +- src/ResponseTypes/RedirectResponse.php | 9 ++ src/ResponseTypes/ResponseTypeInterface.php | 5 +- 35 files changed, 240 insertions(+), 200 deletions(-) diff --git a/src/AuthorizationServer.php b/src/AuthorizationServer.php index 6b7a972b..b46a574f 100644 --- a/src/AuthorizationServer.php +++ b/src/AuthorizationServer.php @@ -9,7 +9,6 @@ namespace League\OAuth2\Server; -use DateInterval; use League\Event\EmitterAwareInterface; use League\Event\EmitterAwareTrait; use League\OAuth2\Server\Exception\OAuthServerException; @@ -28,7 +27,7 @@ class AuthorizationServer implements EmitterAwareInterface use EmitterAwareTrait; /** - * @var \League\OAuth2\Server\Grant\GrantTypeInterface[] + * @var GrantTypeInterface[] */ protected $enabledGrantTypes = []; @@ -38,44 +37,44 @@ class AuthorizationServer implements EmitterAwareInterface protected $grantTypeAccessTokenTTL = []; /** - * @var \League\OAuth2\Server\CryptKey + * @var CryptKey */ protected $privateKey; /** - * @var \League\OAuth2\Server\CryptKey + * @var CryptKey */ protected $publicKey; /** - * @var ResponseTypeInterface + * @var null|ResponseTypeInterface */ protected $responseType; /** - * @var \League\OAuth2\Server\Repositories\ClientRepositoryInterface + * @var ClientRepositoryInterface */ private $clientRepository; /** - * @var \League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface + * @var AccessTokenRepositoryInterface */ private $accessTokenRepository; /** - * @var \League\OAuth2\Server\Repositories\ScopeRepositoryInterface + * @var ScopeRepositoryInterface */ private $scopeRepository; /** * New server instance. * - * @param \League\OAuth2\Server\Repositories\ClientRepositoryInterface $clientRepository - * @param \League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface $accessTokenRepository - * @param \League\OAuth2\Server\Repositories\ScopeRepositoryInterface $scopeRepository - * @param \League\OAuth2\Server\CryptKey|string $privateKey - * @param \League\OAuth2\Server\CryptKey|string $publicKey - * @param null|\League\OAuth2\Server\ResponseTypes\ResponseTypeInterface $responseType + * @param ClientRepositoryInterface $clientRepository + * @param AccessTokenRepositoryInterface $accessTokenRepository + * @param ScopeRepositoryInterface $scopeRepository + * @param CryptKey|string $privateKey + * @param CryptKey|string $publicKey + * @param null|ResponseTypeInterface $responseType */ public function __construct( ClientRepositoryInterface $clientRepository, @@ -105,12 +104,12 @@ class AuthorizationServer implements EmitterAwareInterface /** * Enable a grant type on the server. * - * @param \League\OAuth2\Server\Grant\GrantTypeInterface $grantType - * @param \DateInterval $accessTokenTTL + * @param GrantTypeInterface $grantType + * @param null|\DateInterval $accessTokenTTL */ - public function enableGrantType(GrantTypeInterface $grantType, DateInterval $accessTokenTTL = null) + public function enableGrantType(GrantTypeInterface $grantType, \DateInterval $accessTokenTTL = null) { - if ($accessTokenTTL instanceof DateInterval === false) { + if (!$accessTokenTTL instanceof \DateInterval) { $accessTokenTTL = new \DateInterval('PT1H'); } @@ -128,11 +127,11 @@ class AuthorizationServer implements EmitterAwareInterface /** * Validate an authorization request * - * @param \Psr\Http\Message\ServerRequestInterface $request + * @param ServerRequestInterface $request * - * @throws \League\OAuth2\Server\Exception\OAuthServerException + * @throws OAuthServerException * - * @return \League\OAuth2\Server\RequestTypes\AuthorizationRequest|null + * @return AuthorizationRequest */ public function validateAuthorizationRequest(ServerRequestInterface $request) { @@ -153,10 +152,10 @@ class AuthorizationServer implements EmitterAwareInterface /** * Complete an authorization request * - * @param \League\OAuth2\Server\RequestTypes\AuthorizationRequest $authRequest - * @param \Psr\Http\Message\ResponseInterface $response + * @param AuthorizationRequest $authRequest + * @param ResponseInterface $response * - * @return \Psr\Http\Message\ResponseInterface + * @return ResponseInterface */ public function completeAuthorizationRequest(AuthorizationRequest $authRequest, ResponseInterface $response) { @@ -168,12 +167,12 @@ class AuthorizationServer implements EmitterAwareInterface /** * Return an access token response. * - * @param \Psr\Http\Message\ServerRequestInterface $request - * @param \Psr\Http\Message\ResponseInterface $response + * @param ServerRequestInterface $request + * @param ResponseInterface $response * - * @throws \League\OAuth2\Server\Exception\OAuthServerException + * @throws OAuthServerException * - * @return \Psr\Http\Message\ResponseInterface + * @return ResponseInterface */ public function respondToAccessTokenRequest(ServerRequestInterface $request, ResponseInterface $response) { diff --git a/src/AuthorizationValidators/BearerTokenValidator.php b/src/AuthorizationValidators/BearerTokenValidator.php index 78f2b47c..f24d9abb 100644 --- a/src/AuthorizationValidators/BearerTokenValidator.php +++ b/src/AuthorizationValidators/BearerTokenValidator.php @@ -22,14 +22,12 @@ class BearerTokenValidator implements AuthorizationValidatorInterface use CryptTrait; /** - * @var \League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface + * @var AccessTokenRepositoryInterface */ private $accessTokenRepository; /** - * BearerTokenValidator constructor. - * - * @param \League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface $accessTokenRepository + * @param AccessTokenRepositoryInterface $accessTokenRepository */ public function __construct(AccessTokenRepositoryInterface $accessTokenRepository) { diff --git a/src/CryptKey.php b/src/CryptKey.php index 4ea05264..e088abcf 100644 --- a/src/CryptKey.php +++ b/src/CryptKey.php @@ -8,6 +8,7 @@ * * @link https://github.com/thephpleague/oauth2-server */ + namespace League\OAuth2\Server; class CryptKey @@ -18,7 +19,7 @@ class CryptKey protected $keyPath; /** - * @var string + * @var null|string */ protected $passPhrase; diff --git a/src/CryptTrait.php b/src/CryptTrait.php index 1075ea12..d417e115 100644 --- a/src/CryptTrait.php +++ b/src/CryptTrait.php @@ -8,24 +8,25 @@ * * @link https://github.com/thephpleague/oauth2-server */ + namespace League\OAuth2\Server; trait CryptTrait { /** - * @var \League\OAuth2\Server\CryptKey + * @var CryptKey */ protected $privateKey; /** - * @var \League\OAuth2\Server\CryptKey + * @var CryptKey */ protected $publicKey; /** * Set path to private key. * - * @param \League\OAuth2\Server\CryptKey $privateKey + * @param CryptKey $privateKey */ public function setPrivateKey(CryptKey $privateKey) { @@ -35,7 +36,7 @@ trait CryptTrait /** * Set path to public key. * - * @param \League\OAuth2\Server\CryptKey $publicKey + * @param CryptKey $publicKey */ public function setPublicKey(CryptKey $publicKey) { @@ -47,6 +48,8 @@ trait CryptTrait * * @param string $unencryptedData * + * @throws \LogicException + * * @return string */ protected function encrypt($unencryptedData) diff --git a/src/Entities/AccessTokenEntityInterface.php b/src/Entities/AccessTokenEntityInterface.php index 642cc99f..c297e267 100644 --- a/src/Entities/AccessTokenEntityInterface.php +++ b/src/Entities/AccessTokenEntityInterface.php @@ -16,7 +16,7 @@ interface AccessTokenEntityInterface extends TokenInterface /** * Generate a JWT from the access token * - * @param \League\OAuth2\Server\CryptKey $privateKey + * @param CryptKey $privateKey * * @return string */ diff --git a/src/Entities/RefreshTokenEntityInterface.php b/src/Entities/RefreshTokenEntityInterface.php index c0e7bc4f..05e86e00 100644 --- a/src/Entities/RefreshTokenEntityInterface.php +++ b/src/Entities/RefreshTokenEntityInterface.php @@ -42,14 +42,14 @@ interface RefreshTokenEntityInterface /** * Set the access token that the refresh token was associated with. * - * @param \League\OAuth2\Server\Entities\AccessTokenEntityInterface $accessToken + * @param AccessTokenEntityInterface $accessToken */ public function setAccessToken(AccessTokenEntityInterface $accessToken); /** * Get the access token that the refresh token was originally associated with. * - * @return \League\OAuth2\Server\Entities\AccessTokenEntityInterface + * @return AccessTokenEntityInterface */ public function getAccessToken(); } diff --git a/src/Entities/TokenInterface.php b/src/Entities/TokenInterface.php index f9e5992e..c842b09a 100644 --- a/src/Entities/TokenInterface.php +++ b/src/Entities/TokenInterface.php @@ -63,14 +63,14 @@ interface TokenInterface /** * Set the client that the token was issued to. * - * @param \League\OAuth2\Server\Entities\ClientEntityInterface $client + * @param ClientEntityInterface $client */ public function setClient(ClientEntityInterface $client); /** * Associate a scope with the token. * - * @param \League\OAuth2\Server\Entities\ScopeEntityInterface $scope + * @param ScopeEntityInterface $scope */ public function addScope(ScopeEntityInterface $scope); diff --git a/src/Entities/Traits/AccessTokenTrait.php b/src/Entities/Traits/AccessTokenTrait.php index 31a8eb48..741d6c19 100644 --- a/src/Entities/Traits/AccessTokenTrait.php +++ b/src/Entities/Traits/AccessTokenTrait.php @@ -21,7 +21,7 @@ trait AccessTokenTrait /** * Generate a JWT from the access token * - * @param \League\OAuth2\Server\CryptKey $privateKey + * @param CryptKey $privateKey * * @return string */ diff --git a/src/Entities/Traits/ClientTrait.php b/src/Entities/Traits/ClientTrait.php index 8e44ce09..fec76a6f 100644 --- a/src/Entities/Traits/ClientTrait.php +++ b/src/Entities/Traits/ClientTrait.php @@ -11,8 +11,14 @@ namespace League\OAuth2\Server\Entities\Traits; trait ClientTrait { + /** + * @var string + */ protected $name; + /** + * @var string|string[] + */ protected $redirectUri; /** diff --git a/src/Entities/Traits/RefreshTokenTrait.php b/src/Entities/Traits/RefreshTokenTrait.php index 0734daf1..fb9dbc68 100644 --- a/src/Entities/Traits/RefreshTokenTrait.php +++ b/src/Entities/Traits/RefreshTokenTrait.php @@ -9,7 +9,6 @@ namespace League\OAuth2\Server\Entities\Traits; -use DateTime; use League\OAuth2\Server\Entities\AccessTokenEntityInterface; trait RefreshTokenTrait @@ -20,7 +19,7 @@ trait RefreshTokenTrait protected $accessToken; /** - * @var DateTime + * @var \DateTime */ protected $expiryDateTime; @@ -43,7 +42,7 @@ trait RefreshTokenTrait /** * Get the token's expiry date time. * - * @return DateTime + * @return \DateTime */ public function getExpiryDateTime() { @@ -53,9 +52,9 @@ trait RefreshTokenTrait /** * Set the date time when the token expires. * - * @param DateTime $dateTime + * @param \DateTime $dateTime */ - public function setExpiryDateTime(DateTime $dateTime) + public function setExpiryDateTime(\DateTime $dateTime) { $this->expiryDateTime = $dateTime; } diff --git a/src/Entities/Traits/TokenEntityTrait.php b/src/Entities/Traits/TokenEntityTrait.php index 61c1ef3c..0b5608cd 100644 --- a/src/Entities/Traits/TokenEntityTrait.php +++ b/src/Entities/Traits/TokenEntityTrait.php @@ -9,7 +9,6 @@ namespace League\OAuth2\Server\Entities\Traits; -use DateTime; use League\OAuth2\Server\Entities\ClientEntityInterface; use League\OAuth2\Server\Entities\ScopeEntityInterface; @@ -21,7 +20,7 @@ trait TokenEntityTrait protected $scopes = []; /** - * @var DateTime + * @var \DateTime */ protected $expiryDateTime; @@ -38,7 +37,7 @@ trait TokenEntityTrait /** * Associate a scope with the token. * - * @param \League\OAuth2\Server\Entities\ScopeEntityInterface $scope + * @param ScopeEntityInterface $scope */ public function addScope(ScopeEntityInterface $scope) { @@ -58,7 +57,7 @@ trait TokenEntityTrait /** * Get the token's expiry date time. * - * @return DateTime + * @return \DateTime */ public function getExpiryDateTime() { @@ -68,9 +67,9 @@ trait TokenEntityTrait /** * Set the date time when the token expires. * - * @param DateTime $dateTime + * @param \DateTime $dateTime */ - public function setExpiryDateTime(DateTime $dateTime) + public function setExpiryDateTime(\DateTime $dateTime) { $this->expiryDateTime = $dateTime; } @@ -108,7 +107,7 @@ trait TokenEntityTrait /** * Set the client that the token was issued to. * - * @param \League\OAuth2\Server\Entities\ClientEntityInterface $client + * @param ClientEntityInterface $client */ public function setClient(ClientEntityInterface $client) { diff --git a/src/Exception/OAuthServerException.php b/src/Exception/OAuthServerException.php index 4a6e1832..1d1336a5 100644 --- a/src/Exception/OAuthServerException.php +++ b/src/Exception/OAuthServerException.php @@ -69,7 +69,7 @@ class OAuthServerException extends \Exception * Invalid request error. * * @param string $parameter The invalid parameter - * @param string|null $hint + * @param null|string $hint * * @return static */ @@ -143,7 +143,7 @@ class OAuthServerException extends \Exception /** * Invalid refresh token. * - * @param string|null $hint + * @param null|string $hint * * @return static */ @@ -155,8 +155,8 @@ class OAuthServerException extends \Exception /** * Access denied. * - * @param string|null $hint - * @param string|null $redirectUri + * @param null|string $hint + * @param null|string $redirectUri * * @return static */ @@ -203,11 +203,10 @@ class OAuthServerException extends \Exception /** * Generate a HTTP response. * - * @param \Psr\Http\Message\ResponseInterface $response - * @param bool $useFragment True if errors should be in the URI fragment instead of - * query string + * @param ResponseInterface $response + * @param bool $useFragment True if errors should be in the URI fragment instead of query string * - * @return \Psr\Http\Message\ResponseInterface + * @return ResponseInterface */ public function generateHttpResponse(ResponseInterface $response, $useFragment = false) { diff --git a/src/Grant/AbstractGrant.php b/src/Grant/AbstractGrant.php index 38336b76..2790e80f 100644 --- a/src/Grant/AbstractGrant.php +++ b/src/Grant/AbstractGrant.php @@ -13,7 +13,9 @@ namespace League\OAuth2\Server\Grant; use League\Event\EmitterAwareTrait; use League\OAuth2\Server\CryptTrait; use League\OAuth2\Server\Entities\AccessTokenEntityInterface; +use League\OAuth2\Server\Entities\AuthCodeEntityInterface; use League\OAuth2\Server\Entities\ClientEntityInterface; +use League\OAuth2\Server\Entities\RefreshTokenEntityInterface; use League\OAuth2\Server\Entities\ScopeEntityInterface; use League\OAuth2\Server\Exception\OAuthServerException; use League\OAuth2\Server\Exception\UniqueTokenIdentifierConstraintViolationException; @@ -54,17 +56,17 @@ abstract class AbstractGrant implements GrantTypeInterface protected $scopeRepository; /** - * @var \League\OAuth2\Server\Repositories\AuthCodeRepositoryInterface + * @var AuthCodeRepositoryInterface */ protected $authCodeRepository; /** - * @var \League\OAuth2\Server\Repositories\RefreshTokenRepositoryInterface + * @var RefreshTokenRepositoryInterface */ protected $refreshTokenRepository; /** - * @var \League\OAuth2\Server\Repositories\UserRepositoryInterface + * @var UserRepositoryInterface */ protected $userRepository; @@ -98,7 +100,7 @@ abstract class AbstractGrant implements GrantTypeInterface } /** - * @param \League\OAuth2\Server\Repositories\RefreshTokenRepositoryInterface $refreshTokenRepository + * @param RefreshTokenRepositoryInterface $refreshTokenRepository */ public function setRefreshTokenRepository(RefreshTokenRepositoryInterface $refreshTokenRepository) { @@ -106,7 +108,7 @@ abstract class AbstractGrant implements GrantTypeInterface } /** - * @param \League\OAuth2\Server\Repositories\AuthCodeRepositoryInterface $authCodeRepository + * @param AuthCodeRepositoryInterface $authCodeRepository */ public function setAuthCodeRepository(AuthCodeRepositoryInterface $authCodeRepository) { @@ -114,7 +116,7 @@ abstract class AbstractGrant implements GrantTypeInterface } /** - * @param \League\OAuth2\Server\Repositories\UserRepositoryInterface $userRepository + * @param UserRepositoryInterface $userRepository */ public function setUserRepository(UserRepositoryInterface $userRepository) { @@ -132,11 +134,11 @@ abstract class AbstractGrant implements GrantTypeInterface /** * Validate the client. * - * @param \Psr\Http\Message\ServerRequestInterface $request + * @param ServerRequestInterface $request * - * @throws \League\OAuth2\Server\Exception\OAuthServerException + * @throws OAuthServerException * - * @return \League\OAuth2\Server\Entities\ClientEntityInterface + * @return ClientEntityInterface */ protected function validateClient(ServerRequestInterface $request) { @@ -189,9 +191,9 @@ abstract class AbstractGrant implements GrantTypeInterface * @param string $scopes * @param string $redirectUri * - * @throws \League\OAuth2\Server\Exception\OAuthServerException + * @throws OAuthServerException * - * @return \League\OAuth2\Server\Entities\ScopeEntityInterface[] + * @return ScopeEntityInterface[] */ public function validateScopes( $scopes, @@ -221,9 +223,9 @@ abstract class AbstractGrant implements GrantTypeInterface /** * Retrieve request parameter. * - * @param string $parameter - * @param \Psr\Http\Message\ServerRequestInterface $request - * @param mixed $default + * @param string $parameter + * @param ServerRequestInterface $request + * @param mixed $default * * @return null|string */ @@ -241,7 +243,8 @@ abstract class AbstractGrant implements GrantTypeInterface * not exist, or is otherwise an invalid HTTP Basic header, return * [null, null]. * - * @param \Psr\Http\Message\ServerRequestInterface $request + * @param ServerRequestInterface $request + * * @return string[]|null[] */ protected function getBasicAuthCredentials(ServerRequestInterface $request) @@ -269,9 +272,9 @@ abstract class AbstractGrant implements GrantTypeInterface /** * Retrieve query string parameter. * - * @param string $parameter - * @param \Psr\Http\Message\ServerRequestInterface $request - * @param mixed $default + * @param string $parameter + * @param ServerRequestInterface $request + * @param mixed $default * * @return null|string */ @@ -283,9 +286,9 @@ abstract class AbstractGrant implements GrantTypeInterface /** * Retrieve cookie parameter. * - * @param string $parameter - * @param \Psr\Http\Message\ServerRequestInterface $request - * @param mixed $default + * @param string $parameter + * @param ServerRequestInterface $request + * @param mixed $default * * @return null|string */ @@ -297,9 +300,9 @@ abstract class AbstractGrant implements GrantTypeInterface /** * Retrieve server parameter. * - * @param string $parameter - * @param \Psr\Http\Message\ServerRequestInterface $request - * @param mixed $default + * @param string $parameter + * @param ServerRequestInterface $request + * @param mixed $default * * @return null|string */ @@ -311,12 +314,15 @@ abstract class AbstractGrant implements GrantTypeInterface /** * Issue an access token. * - * @param \DateInterval $accessTokenTTL - * @param \League\OAuth2\Server\Entities\ClientEntityInterface $client - * @param string $userIdentifier - * @param \League\OAuth2\Server\Entities\ScopeEntityInterface[] $scopes + * @param \DateInterval $accessTokenTTL + * @param ClientEntityInterface $client + * @param string $userIdentifier + * @param ScopeEntityInterface[] $scopes * - * @return \League\OAuth2\Server\Entities\AccessTokenEntityInterface + * @throws OAuthServerException + * @throws UniqueTokenIdentifierConstraintViolationException + * + * @return AccessTokenEntityInterface */ protected function issueAccessToken( \DateInterval $accessTokenTTL, @@ -351,13 +357,16 @@ abstract class AbstractGrant implements GrantTypeInterface /** * Issue an auth code. * - * @param \DateInterval $authCodeTTL - * @param \League\OAuth2\Server\Entities\ClientEntityInterface $client - * @param string $userIdentifier - * @param string $redirectUri - * @param \League\OAuth2\Server\Entities\ScopeEntityInterface[] $scopes + * @param \DateInterval $authCodeTTL + * @param ClientEntityInterface $client + * @param string $userIdentifier + * @param string $redirectUri + * @param ScopeEntityInterface[] $scopes * - * @return \League\OAuth2\Server\Entities\AuthCodeEntityInterface + * @throws OAuthServerException + * @throws UniqueTokenIdentifierConstraintViolationException + * + * @return AuthCodeEntityInterface */ protected function issueAuthCode( \DateInterval $authCodeTTL, @@ -392,9 +401,12 @@ abstract class AbstractGrant implements GrantTypeInterface } /** - * @param \League\OAuth2\Server\Entities\AccessTokenEntityInterface $accessToken + * @param AccessTokenEntityInterface $accessToken * - * @return \League\OAuth2\Server\Entities\RefreshTokenEntityInterface + * @throws OAuthServerException + * @throws UniqueTokenIdentifierConstraintViolationException + * + * @return RefreshTokenEntityInterface */ protected function issueRefreshToken(AccessTokenEntityInterface $accessToken) { @@ -422,7 +434,7 @@ abstract class AbstractGrant implements GrantTypeInterface * * @param int $length * - * @throws \League\OAuth2\Server\Exception\OAuthServerException + * @throws OAuthServerException * * @return string */ diff --git a/src/Grant/AuthCodeGrant.php b/src/Grant/AuthCodeGrant.php index aba20aea..babf3d56 100644 --- a/src/Grant/AuthCodeGrant.php +++ b/src/Grant/AuthCodeGrant.php @@ -9,7 +9,6 @@ namespace League\OAuth2\Server\Grant; -use DateInterval; use League\OAuth2\Server\Entities\ClientEntityInterface; use League\OAuth2\Server\Entities\ScopeEntityInterface; use League\OAuth2\Server\Entities\UserEntityInterface; @@ -35,9 +34,9 @@ class AuthCodeGrant extends AbstractAuthorizeGrant private $enableCodeExchangeProof = false; /** - * @param \League\OAuth2\Server\Repositories\AuthCodeRepositoryInterface $authCodeRepository - * @param \League\OAuth2\Server\Repositories\RefreshTokenRepositoryInterface $refreshTokenRepository - * @param \DateInterval $authCodeTTL + * @param AuthCodeRepositoryInterface $authCodeRepository + * @param RefreshTokenRepositoryInterface $refreshTokenRepository + * @param \DateInterval $authCodeTTL */ public function __construct( AuthCodeRepositoryInterface $authCodeRepository, @@ -58,18 +57,18 @@ class AuthCodeGrant extends AbstractAuthorizeGrant /** * Respond to an access token request. * - * @param \Psr\Http\Message\ServerRequestInterface $request - * @param \League\OAuth2\Server\ResponseTypes\ResponseTypeInterface $responseType - * @param \DateInterval $accessTokenTTL + * @param ServerRequestInterface $request + * @param ResponseTypeInterface $responseType + * @param \DateInterval $accessTokenTTL * - * @throws \League\OAuth2\Server\Exception\OAuthServerException + * @throws OAuthServerException * - * @return \League\OAuth2\Server\ResponseTypes\ResponseTypeInterface + * @return ResponseTypeInterface */ public function respondToAccessTokenRequest( ServerRequestInterface $request, ResponseTypeInterface $responseType, - DateInterval $accessTokenTTL + \DateInterval $accessTokenTTL ) { // Validate request $client = $this->validateClient($request); @@ -221,7 +220,7 @@ class AuthCodeGrant extends AbstractAuthorizeGrant false ); - if ($client instanceof ClientEntityInterface === false) { + if (!$client instanceof ClientEntityInterface) { $this->getEmitter()->emit(new RequestEvent(RequestEvent::CLIENT_AUTHENTICATION_FAILED, $request)); throw OAuthServerException::invalidClient(); } @@ -285,7 +284,7 @@ class AuthCodeGrant extends AbstractAuthorizeGrant */ public function completeAuthorizationRequest(AuthorizationRequest $authorizationRequest) { - if ($authorizationRequest->getUser() instanceof UserEntityInterface === false) { + if (!$authorizationRequest->getUser() instanceof UserEntityInterface) { throw new \LogicException('An instance of UserEntityInterface should be set on the AuthorizationRequest'); } diff --git a/src/Grant/ClientCredentialsGrant.php b/src/Grant/ClientCredentialsGrant.php index c8ff2d52..b5b968d4 100644 --- a/src/Grant/ClientCredentialsGrant.php +++ b/src/Grant/ClientCredentialsGrant.php @@ -8,6 +8,7 @@ * * @link https://github.com/thephpleague/oauth2-server */ + namespace League\OAuth2\Server\Grant; use League\OAuth2\Server\ResponseTypes\ResponseTypeInterface; diff --git a/src/Grant/GrantTypeInterface.php b/src/Grant/GrantTypeInterface.php index c0ffdd9c..c01a571d 100644 --- a/src/Grant/GrantTypeInterface.php +++ b/src/Grant/GrantTypeInterface.php @@ -8,6 +8,7 @@ * * @link https://github.com/thephpleague/oauth2-server */ + namespace League\OAuth2\Server\Grant; use League\Event\EmitterAwareInterface; @@ -41,11 +42,11 @@ interface GrantTypeInterface extends EmitterAwareInterface /** * Respond to an incoming request. * - * @param \Psr\Http\Message\ServerRequestInterface $request - * @param \League\OAuth2\Server\ResponseTypes\ResponseTypeInterface $responseType - * @param \DateInterval $accessTokenTTL + * @param ServerRequestInterface $request + * @param ResponseTypeInterface $responseType + * @param \DateInterval $accessTokenTTL * - * @return \League\OAuth2\Server\ResponseTypes\ResponseTypeInterface + * @return ResponseTypeInterface */ public function respondToAccessTokenRequest( ServerRequestInterface $request, @@ -56,7 +57,7 @@ interface GrantTypeInterface extends EmitterAwareInterface /** * The grant type should return true if it is able to response to an authorization request * - * @param \Psr\Http\Message\ServerRequestInterface $request + * @param ServerRequestInterface $request * * @return bool */ @@ -69,7 +70,7 @@ interface GrantTypeInterface extends EmitterAwareInterface * If the validation is successful an AuthorizationRequest object will be returned. This object can be safely * serialized in a user's session, and can be used during user authentication and authorization. * - * @param \Psr\Http\Message\ServerRequestInterface $request + * @param ServerRequestInterface $request * * @return AuthorizationRequest */ @@ -80,9 +81,9 @@ interface GrantTypeInterface extends EmitterAwareInterface * The AuthorizationRequest object's $userId property must be set to the authenticated user and the * $authorizationApproved property must reflect their desire to authorize or deny the client. * - * @param \League\OAuth2\Server\RequestTypes\AuthorizationRequest $authorizationRequest + * @param AuthorizationRequest $authorizationRequest * - * @return \League\OAuth2\Server\ResponseTypes\ResponseTypeInterface + * @return ResponseTypeInterface */ public function completeAuthorizationRequest(AuthorizationRequest $authorizationRequest); @@ -91,7 +92,7 @@ interface GrantTypeInterface extends EmitterAwareInterface * * For example most grant types will check that the $_POST['grant_type'] property matches it's identifier property. * - * @param \Psr\Http\Message\ServerRequestInterface $request + * @param ServerRequestInterface $request * * @return bool */ @@ -100,35 +101,35 @@ interface GrantTypeInterface extends EmitterAwareInterface /** * Set the client repository. * - * @param \League\OAuth2\Server\Repositories\ClientRepositoryInterface $clientRepository + * @param ClientRepositoryInterface $clientRepository */ public function setClientRepository(ClientRepositoryInterface $clientRepository); /** * Set the access token repository. * - * @param \League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface $accessTokenRepository + * @param AccessTokenRepositoryInterface $accessTokenRepository */ public function setAccessTokenRepository(AccessTokenRepositoryInterface $accessTokenRepository); /** * Set the scope repository. * - * @param \League\OAuth2\Server\Repositories\ScopeRepositoryInterface $scopeRepository + * @param ScopeRepositoryInterface $scopeRepository */ public function setScopeRepository(ScopeRepositoryInterface $scopeRepository); /** * Set the path to the private key. * - * @param \League\OAuth2\Server\CryptKey $privateKey + * @param CryptKey $privateKey */ public function setPrivateKey(CryptKey $privateKey); /** * Set the path to the public key. * - * @param \League\OAuth2\Server\CryptKey $publicKey + * @param CryptKey $publicKey */ public function setPublicKey(CryptKey $publicKey); } diff --git a/src/Grant/ImplicitGrant.php b/src/Grant/ImplicitGrant.php index 6f415164..08585f15 100644 --- a/src/Grant/ImplicitGrant.php +++ b/src/Grant/ImplicitGrant.php @@ -45,7 +45,7 @@ class ImplicitGrant extends AbstractAuthorizeGrant } /** - * @param \League\OAuth2\Server\Repositories\RefreshTokenRepositoryInterface $refreshTokenRepository + * @param RefreshTokenRepositoryInterface $refreshTokenRepository * * @throw \LogicException */ @@ -75,11 +75,11 @@ class ImplicitGrant extends AbstractAuthorizeGrant /** * Respond to an incoming request. * - * @param \Psr\Http\Message\ServerRequestInterface $request - * @param \League\OAuth2\Server\ResponseTypes\ResponseTypeInterface $responseType - * @param \DateInterval $accessTokenTTL + * @param ServerRequestInterface $request + * @param ResponseTypeInterface $responseType + * @param \DateInterval $accessTokenTTL * - * @return \League\OAuth2\Server\ResponseTypes\ResponseTypeInterface + * @return ResponseTypeInterface */ public function respondToAccessTokenRequest( ServerRequestInterface $request, @@ -122,7 +122,7 @@ class ImplicitGrant extends AbstractAuthorizeGrant false ); - if ($client instanceof ClientEntityInterface === false) { + if (!$client instanceof ClientEntityInterface) { $this->getEmitter()->emit(new RequestEvent(RequestEvent::CLIENT_AUTHENTICATION_FAILED, $request)); throw OAuthServerException::invalidClient(); } @@ -168,7 +168,7 @@ class ImplicitGrant extends AbstractAuthorizeGrant */ public function completeAuthorizationRequest(AuthorizationRequest $authorizationRequest) { - if ($authorizationRequest->getUser() instanceof UserEntityInterface === false) { + if (!$authorizationRequest->getUser() instanceof UserEntityInterface) { throw new \LogicException('An instance of UserEntityInterface should be set on the AuthorizationRequest'); } diff --git a/src/Grant/PasswordGrant.php b/src/Grant/PasswordGrant.php index 86ba1e32..07eba5f1 100644 --- a/src/Grant/PasswordGrant.php +++ b/src/Grant/PasswordGrant.php @@ -8,6 +8,7 @@ * * @link https://github.com/thephpleague/oauth2-server */ + namespace League\OAuth2\Server\Grant; use League\OAuth2\Server\Entities\ClientEntityInterface; @@ -25,8 +26,8 @@ use Psr\Http\Message\ServerRequestInterface; class PasswordGrant extends AbstractGrant { /** - * @param \League\OAuth2\Server\Repositories\UserRepositoryInterface $userRepository - * @param \League\OAuth2\Server\Repositories\RefreshTokenRepositoryInterface $refreshTokenRepository + * @param UserRepositoryInterface $userRepository + * @param RefreshTokenRepositoryInterface $refreshTokenRepository */ public function __construct( UserRepositoryInterface $userRepository, @@ -66,12 +67,12 @@ class PasswordGrant extends AbstractGrant } /** - * @param \Psr\Http\Message\ServerRequestInterface $request - * @param \League\OAuth2\Server\Entities\ClientEntityInterface $client + * @param ServerRequestInterface $request + * @param ClientEntityInterface $client * - * @throws \League\OAuth2\Server\Exception\OAuthServerException + * @throws OAuthServerException * - * @return \League\OAuth2\Server\Entities\UserEntityInterface + * @return UserEntityInterface */ protected function validateUser(ServerRequestInterface $request, ClientEntityInterface $client) { diff --git a/src/Grant/RefreshTokenGrant.php b/src/Grant/RefreshTokenGrant.php index d4d693a6..600eae8f 100644 --- a/src/Grant/RefreshTokenGrant.php +++ b/src/Grant/RefreshTokenGrant.php @@ -8,6 +8,7 @@ * * @link https://github.com/thephpleague/oauth2-server */ + namespace League\OAuth2\Server\Grant; use League\OAuth2\Server\Entities\ScopeEntityInterface; @@ -23,7 +24,7 @@ use Psr\Http\Message\ServerRequestInterface; class RefreshTokenGrant extends AbstractGrant { /** - * @param \League\OAuth2\Server\Repositories\RefreshTokenRepositoryInterface $refreshTokenRepository + * @param RefreshTokenRepositoryInterface $refreshTokenRepository */ public function __construct(RefreshTokenRepositoryInterface $refreshTokenRepository) { @@ -84,10 +85,10 @@ class RefreshTokenGrant extends AbstractGrant } /** - * @param \Psr\Http\Message\ServerRequestInterface $request - * @param string $clientId + * @param ServerRequestInterface $request + * @param string $clientId * - * @throws \League\OAuth2\Server\Exception\OAuthServerException + * @throws OAuthServerException * * @return array */ diff --git a/src/Middleware/AuthorizationServerMiddleware.php b/src/Middleware/AuthorizationServerMiddleware.php index 6c2d08b2..a5f102fc 100644 --- a/src/Middleware/AuthorizationServerMiddleware.php +++ b/src/Middleware/AuthorizationServerMiddleware.php @@ -17,14 +17,12 @@ use Psr\Http\Message\ServerRequestInterface; class AuthorizationServerMiddleware { /** - * @var \League\OAuth2\Server\AuthorizationServer + * @var AuthorizationServer */ private $server; /** - * AuthorizationServerMiddleware constructor. - * - * @param \League\OAuth2\Server\AuthorizationServer $server + * @param AuthorizationServer $server */ public function __construct(AuthorizationServer $server) { @@ -32,11 +30,11 @@ class AuthorizationServerMiddleware } /** - * @param \Psr\Http\Message\ServerRequestInterface $request - * @param \Psr\Http\Message\ResponseInterface $response - * @param callable $next + * @param ServerRequestInterface $request + * @param ResponseInterface $response + * @param callable $next * - * @return \Psr\Http\Message\ResponseInterface + * @return ResponseInterface */ public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) { diff --git a/src/Middleware/ResourceServerMiddleware.php b/src/Middleware/ResourceServerMiddleware.php index 9e235c35..56d28aee 100644 --- a/src/Middleware/ResourceServerMiddleware.php +++ b/src/Middleware/ResourceServerMiddleware.php @@ -17,14 +17,12 @@ use Psr\Http\Message\ServerRequestInterface; class ResourceServerMiddleware { /** - * @var \League\OAuth2\Server\ResourceServer + * @var ResourceServer */ private $server; /** - * ResourceServerMiddleware constructor. - * - * @param \League\OAuth2\Server\ResourceServer $server + * @param ResourceServer $server */ public function __construct(ResourceServer $server) { @@ -32,9 +30,9 @@ class ResourceServerMiddleware } /** - * @param \Psr\Http\Message\ServerRequestInterface $request - * @param \Psr\Http\Message\ResponseInterface $response - * @param callable $next + * @param ServerRequestInterface $request + * @param ResponseInterface $response + * @param callable $next * * @return \Psr\Http\Message\ResponseInterface */ diff --git a/src/Repositories/AccessTokenRepositoryInterface.php b/src/Repositories/AccessTokenRepositoryInterface.php index aab8eab8..04e98bc6 100644 --- a/src/Repositories/AccessTokenRepositoryInterface.php +++ b/src/Repositories/AccessTokenRepositoryInterface.php @@ -11,6 +11,7 @@ namespace League\OAuth2\Server\Repositories; use League\OAuth2\Server\Entities\AccessTokenEntityInterface; use League\OAuth2\Server\Entities\ClientEntityInterface; +use League\OAuth2\Server\Entities\ScopeEntityInterface; /** * Access token interface. @@ -20,9 +21,9 @@ interface AccessTokenRepositoryInterface extends RepositoryInterface /** * Create a new access token * - * @param \League\OAuth2\Server\Entities\ClientEntityInterface $clientEntity - * @param \League\OAuth2\Server\Entities\ScopeEntityInterface[] $scopes - * @param mixed $userIdentifier + * @param ClientEntityInterface $clientEntity + * @param ScopeEntityInterface[] $scopes + * @param mixed $userIdentifier * * @return AccessTokenEntityInterface */ @@ -31,7 +32,7 @@ interface AccessTokenRepositoryInterface extends RepositoryInterface /** * Persists a new access token to permanent storage. * - * @param \League\OAuth2\Server\Entities\AccessTokenEntityInterface $accessTokenEntity + * @param AccessTokenEntityInterface $accessTokenEntity */ public function persistNewAccessToken(AccessTokenEntityInterface $accessTokenEntity); diff --git a/src/Repositories/AuthCodeRepositoryInterface.php b/src/Repositories/AuthCodeRepositoryInterface.php index cfe3b4d8..4d23439a 100644 --- a/src/Repositories/AuthCodeRepositoryInterface.php +++ b/src/Repositories/AuthCodeRepositoryInterface.php @@ -6,6 +6,7 @@ * * @link https://github.com/thephpleague/oauth2-server */ + namespace League\OAuth2\Server\Repositories; use League\OAuth2\Server\Entities\AuthCodeEntityInterface; @@ -18,14 +19,14 @@ interface AuthCodeRepositoryInterface extends RepositoryInterface /** * Creates a new AuthCode * - * @return \League\OAuth2\Server\Entities\AuthCodeEntityInterface + * @return AuthCodeEntityInterface */ public function getNewAuthCode(); /** * Persists a new auth code to permanent storage. * - * @param \League\OAuth2\Server\Entities\AuthCodeEntityInterface $authCodeEntity + * @param AuthCodeEntityInterface $authCodeEntity */ public function persistNewAuthCode(AuthCodeEntityInterface $authCodeEntity); diff --git a/src/Repositories/ClientRepositoryInterface.php b/src/Repositories/ClientRepositoryInterface.php index fc56c2f3..34adf56a 100644 --- a/src/Repositories/ClientRepositoryInterface.php +++ b/src/Repositories/ClientRepositoryInterface.php @@ -6,8 +6,11 @@ * * @link https://github.com/thephpleague/oauth2-server */ + namespace League\OAuth2\Server\Repositories; +use League\OAuth2\Server\Entities\ClientEntityInterface; + /** * Client storage interface. */ @@ -19,10 +22,10 @@ interface ClientRepositoryInterface extends RepositoryInterface * @param string $clientIdentifier The client's identifier * @param string $grantType The grant type used * @param null|string $clientSecret The client's secret (if sent) - * @param bool $mustValidateSecret If true the client must attempt to validate the secret unless the client + * @param bool $mustValidateSecret If true the client must attempt to validate the secret if the client * is confidential * - * @return \League\OAuth2\Server\Entities\ClientEntityInterface + * @return ClientEntityInterface */ public function getClientEntity($clientIdentifier, $grantType, $clientSecret = null, $mustValidateSecret = true); } diff --git a/src/Repositories/RefreshTokenRepositoryInterface.php b/src/Repositories/RefreshTokenRepositoryInterface.php index 49d3ea4a..d7e686cc 100644 --- a/src/Repositories/RefreshTokenRepositoryInterface.php +++ b/src/Repositories/RefreshTokenRepositoryInterface.php @@ -6,6 +6,7 @@ * * @link https://github.com/thephpleague/oauth2-server */ + namespace League\OAuth2\Server\Repositories; use League\OAuth2\Server\Entities\RefreshTokenEntityInterface; @@ -25,7 +26,7 @@ interface RefreshTokenRepositoryInterface extends RepositoryInterface /** * Create a new refresh token_name. * - * @param \League\OAuth2\Server\Entities\RefreshTokenEntityInterface $refreshTokenEntity + * @param RefreshTokenEntityInterface $refreshTokenEntity */ public function persistNewRefreshToken(RefreshTokenEntityInterface $refreshTokenEntity); diff --git a/src/Repositories/RepositoryInterface.php b/src/Repositories/RepositoryInterface.php index 3e50d4de..9c27b4b0 100644 --- a/src/Repositories/RepositoryInterface.php +++ b/src/Repositories/RepositoryInterface.php @@ -6,6 +6,7 @@ * * @link https://github.com/thephpleague/oauth2-server */ + namespace League\OAuth2\Server\Repositories; /** diff --git a/src/Repositories/ScopeRepositoryInterface.php b/src/Repositories/ScopeRepositoryInterface.php index 568f0e57..52db05de 100644 --- a/src/Repositories/ScopeRepositoryInterface.php +++ b/src/Repositories/ScopeRepositoryInterface.php @@ -22,7 +22,7 @@ interface ScopeRepositoryInterface extends RepositoryInterface * * @param string $identifier The scope identifier * - * @return \League\OAuth2\Server\Entities\ScopeEntityInterface + * @return ScopeEntityInterface */ public function getScopeEntityByIdentifier($identifier); @@ -30,12 +30,12 @@ interface ScopeRepositoryInterface extends RepositoryInterface * Given a client, grant type and optional user identifier validate the set of scopes requested are valid and optionally * append additional scopes or remove requested scopes. * - * @param ScopeEntityInterface[] $scopes - * @param string $grantType - * @param \League\OAuth2\Server\Entities\ClientEntityInterface $clientEntity - * @param null|string $userIdentifier + * @param ScopeEntityInterface[] $scopes + * @param string $grantType + * @param ClientEntityInterface $clientEntity + * @param null|string $userIdentifier * - * @return \League\OAuth2\Server\Entities\ScopeEntityInterface[] + * @return ScopeEntityInterface[] */ public function finalizeScopes( array $scopes, diff --git a/src/Repositories/UserRepositoryInterface.php b/src/Repositories/UserRepositoryInterface.php index b2de24d6..0a9efef0 100644 --- a/src/Repositories/UserRepositoryInterface.php +++ b/src/Repositories/UserRepositoryInterface.php @@ -10,18 +10,19 @@ namespace League\OAuth2\Server\Repositories; use League\OAuth2\Server\Entities\ClientEntityInterface; +use League\OAuth2\Server\Entities\UserEntityInterface; interface UserRepositoryInterface extends RepositoryInterface { /** * Get a user entity. * - * @param string $username - * @param string $password - * @param string $grantType The grant type used - * @param \League\OAuth2\Server\Entities\ClientEntityInterface $clientEntity + * @param string $username + * @param string $password + * @param string $grantType The grant type used + * @param ClientEntityInterface $clientEntity * - * @return \League\OAuth2\Server\Entities\UserEntityInterface + * @return UserEntityInterface */ public function getUserEntityByUserCredentials( $username, diff --git a/src/RequestEvent.php b/src/RequestEvent.php index 42ce47b2..1558e11f 100644 --- a/src/RequestEvent.php +++ b/src/RequestEvent.php @@ -6,6 +6,7 @@ * * @link https://github.com/thephpleague/oauth2-server */ + namespace League\OAuth2\Server; use League\Event\Event; @@ -18,15 +19,15 @@ class RequestEvent extends Event const REFRESH_TOKEN_CLIENT_FAILED = 'refresh_token.client.failed'; /** - * @var \Psr\Http\Message\ServerRequestInterface + * @var ServerRequestInterface */ private $request; /** * RequestEvent constructor. * - * @param string $name - * @param \Psr\Http\Message\ServerRequestInterface $request + * @param string $name + * @param ServerRequestInterface $request */ public function __construct($name, ServerRequestInterface $request) { diff --git a/src/RequestTypes/AuthorizationRequest.php b/src/RequestTypes/AuthorizationRequest.php index 2a5fcd5f..ad67dafd 100644 --- a/src/RequestTypes/AuthorizationRequest.php +++ b/src/RequestTypes/AuthorizationRequest.php @@ -125,7 +125,7 @@ class AuthorizationRequest } /** - * @return \League\OAuth2\Server\Entities\ScopeEntityInterface[] + * @return ScopeEntityInterface[] */ public function getScopes() { @@ -133,9 +133,9 @@ class AuthorizationRequest } /** - * @param \League\OAuth2\Server\Entities\ScopeEntityInterface[] $scopes + * @param ScopeEntityInterface[] $scopes */ - public function setScopes($scopes) + public function setScopes(array $scopes) { $this->scopes = $scopes; } diff --git a/src/ResourceServer.php b/src/ResourceServer.php index 6fe8b1fc..0fb8fbee 100644 --- a/src/ResourceServer.php +++ b/src/ResourceServer.php @@ -6,34 +6,38 @@ * * @link https://github.com/thephpleague/oauth2-server */ + namespace League\OAuth2\Server; use League\OAuth2\Server\AuthorizationValidators\AuthorizationValidatorInterface; use League\OAuth2\Server\AuthorizationValidators\BearerTokenValidator; +use League\OAuth2\Server\Exception\OAuthServerException; use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface; use Psr\Http\Message\ServerRequestInterface; class ResourceServer { /** - * @var \League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface + * @var AccessTokenRepositoryInterface */ private $accessTokenRepository; + /** - * @var \League\OAuth2\Server\CryptKey|string + * @var CryptKey */ private $publicKey; + /** - * @var \League\OAuth2\Server\AuthorizationValidators\AuthorizationValidatorInterface|null + * @var null|AuthorizationValidatorInterface */ private $authorizationValidator; /** * New server instance. * - * @param \League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface $accessTokenRepository - * @param \League\OAuth2\Server\CryptKey|string $publicKey - * @param null|\League\OAuth2\Server\AuthorizationValidators\AuthorizationValidatorInterface $authorizationValidator + * @param AccessTokenRepositoryInterface $accessTokenRepository + * @param CryptKey|string $publicKey + * @param null|AuthorizationValidatorInterface $authorizationValidator */ public function __construct( AccessTokenRepositoryInterface $accessTokenRepository, @@ -51,7 +55,7 @@ class ResourceServer } /** - * @return \League\OAuth2\Server\AuthorizationValidators\AuthorizationValidatorInterface + * @return AuthorizationValidatorInterface */ protected function getAuthorizationValidator() { @@ -67,11 +71,11 @@ class ResourceServer /** * Determine the access token validity. * - * @param \Psr\Http\Message\ServerRequestInterface $request + * @param ServerRequestInterface $request * - * @throws \League\OAuth2\Server\Exception\OAuthServerException + * @throws OAuthServerException * - * @return \Psr\Http\Message\ServerRequestInterface + * @return ServerRequestInterface */ public function validateAuthenticatedRequest(ServerRequestInterface $request) { diff --git a/src/ResponseTypes/AbstractResponseType.php b/src/ResponseTypes/AbstractResponseType.php index 02ce842b..6e164392 100644 --- a/src/ResponseTypes/AbstractResponseType.php +++ b/src/ResponseTypes/AbstractResponseType.php @@ -8,6 +8,7 @@ * * @link https://github.com/thephpleague/oauth2-server */ + namespace League\OAuth2\Server\ResponseTypes; use League\OAuth2\Server\CryptTrait; @@ -19,12 +20,12 @@ abstract class AbstractResponseType implements ResponseTypeInterface use CryptTrait; /** - * @var \League\OAuth2\Server\Entities\AccessTokenEntityInterface + * @var AccessTokenEntityInterface */ protected $accessToken; /** - * @var \League\OAuth2\Server\Entities\RefreshTokenEntityInterface + * @var RefreshTokenEntityInterface */ protected $refreshToken; diff --git a/src/ResponseTypes/BearerTokenResponse.php b/src/ResponseTypes/BearerTokenResponse.php index a65ecaae..921f13b0 100644 --- a/src/ResponseTypes/BearerTokenResponse.php +++ b/src/ResponseTypes/BearerTokenResponse.php @@ -1,6 +1,6 @@ * @copyright Copyright (c) Alex Bilbie @@ -8,6 +8,7 @@ * * @link https://github.com/thephpleague/oauth2-server */ + namespace League\OAuth2\Server\ResponseTypes; use League\OAuth2\Server\Entities\RefreshTokenEntityInterface; diff --git a/src/ResponseTypes/RedirectResponse.php b/src/ResponseTypes/RedirectResponse.php index 575a49e7..e4639148 100644 --- a/src/ResponseTypes/RedirectResponse.php +++ b/src/ResponseTypes/RedirectResponse.php @@ -1,4 +1,13 @@ + * @copyright Copyright (c) Alex Bilbie + * @license http://mit-license.org/ + * + * @link https://github.com/thephpleague/oauth2-server + */ namespace League\OAuth2\Server\ResponseTypes; diff --git a/src/ResponseTypes/ResponseTypeInterface.php b/src/ResponseTypes/ResponseTypeInterface.php index a26466a7..9f358a53 100644 --- a/src/ResponseTypes/ResponseTypeInterface.php +++ b/src/ResponseTypes/ResponseTypeInterface.php @@ -8,6 +8,7 @@ * * @link https://github.com/thephpleague/oauth2-server */ + namespace League\OAuth2\Server\ResponseTypes; use League\OAuth2\Server\Entities\AccessTokenEntityInterface; @@ -17,12 +18,12 @@ use Psr\Http\Message\ResponseInterface; interface ResponseTypeInterface { /** - * @param \League\OAuth2\Server\Entities\AccessTokenEntityInterface $accessToken + * @param AccessTokenEntityInterface $accessToken */ public function setAccessToken(AccessTokenEntityInterface $accessToken); /** - * @param \League\OAuth2\Server\Entities\RefreshTokenEntityInterface $refreshToken + * @param RefreshTokenEntityInterface $refreshToken */ public function setRefreshToken(RefreshTokenEntityInterface $refreshToken);