From bc16022abf3b46e9c4df8ee985a7f7d2d0df2333 Mon Sep 17 00:00:00 2001 From: ShawnCZek Date: Wed, 28 Dec 2022 12:13:53 +0100 Subject: [PATCH 1/2] Unify the style of PHPDoc --- src/Provider/Discord.php | 15 ++++++++------- src/Provider/DiscordResourceOwner.php | 3 ++- .../DiscordIdentityProviderException.php | 2 -- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Provider/Discord.php b/src/Provider/Discord.php index 5611824..a868bad 100644 --- a/src/Provider/Discord.php +++ b/src/Provider/Discord.php @@ -14,6 +14,8 @@ namespace Wohali\OAuth2\Client\Provider; use League\OAuth2\Client\Provider\AbstractProvider; +use League\OAuth2\Client\Provider\Exception\IdentityProviderException; +use League\OAuth2\Client\Provider\ResourceOwnerInterface; use League\OAuth2\Client\Token\AccessToken; use League\OAuth2\Client\Tool\BearerAuthorizationTrait; use Psr\Http\Message\ResponseInterface; @@ -44,7 +46,6 @@ public function getBaseAuthorizationUrl() * Get access token URL to retrieve token * * @param array $params - * * @return string */ public function getBaseAccessTokenUrl(array $params) @@ -56,7 +57,6 @@ public function getBaseAccessTokenUrl(array $params) * Get provider URL to retrieve user details * * @param AccessToken $token - * * @return string */ public function getResourceOwnerDetailsUrl(AccessToken $token) @@ -99,10 +99,11 @@ protected function getDefaultScopes() /** * Check a provider response for errors. * - * @throws IdentityProviderException - * @param ResponseInterface @response + * @param ResponseInterface $response * @param array $data Parsed response data * @return void + * + * @throws IdentityProviderException */ protected function checkResponse(ResponseInterface $response, $data) { @@ -114,9 +115,9 @@ protected function checkResponse(ResponseInterface $response, $data) /** * Generate a user object from a successful user details request. * - * @param array $response - * @param AccessToken $token - * @return \League\OAuth2\Client\Provider\ResourceOwnerInterface + * @param array $response + * @param AccessToken $token + * @return ResourceOwnerInterface */ protected function createResourceOwner(array $response, AccessToken $token) { diff --git a/src/Provider/DiscordResourceOwner.php b/src/Provider/DiscordResourceOwner.php index 549948c..f0933d7 100644 --- a/src/Provider/DiscordResourceOwner.php +++ b/src/Provider/DiscordResourceOwner.php @@ -30,7 +30,8 @@ class DiscordResourceOwner implements ResourceOwnerInterface /** * Creates new resource owner. * - * @param array $response + * @param array $response + * @return void */ public function __construct(array $response = array()) { diff --git a/src/Provider/Exception/DiscordIdentityProviderException.php b/src/Provider/Exception/DiscordIdentityProviderException.php index 5f690e8..3fd1342 100644 --- a/src/Provider/Exception/DiscordIdentityProviderException.php +++ b/src/Provider/Exception/DiscordIdentityProviderException.php @@ -23,7 +23,6 @@ class DiscordIdentityProviderException extends IdentityProviderException * * @param ResponseInterface $response * @param array $data Parsed response data - * * @return IdentityProviderException */ public static function clientException(ResponseInterface $response, $data) @@ -39,7 +38,6 @@ public static function clientException(ResponseInterface $response, $data) * * @param ResponseInterface $response * @param string $message - * * @return IdentityProviderException */ protected static function fromResponse(ResponseInterface $response, $message = null) From 196f800da16234eed0ff9d1d2de5cb8de55e2739 Mon Sep 17 00:00:00 2001 From: ShawnCZek Date: Wed, 28 Dec 2022 12:14:36 +0100 Subject: [PATCH 2/2] Use null coalescing operator when appropriate --- src/Provider/Exception/DiscordIdentityProviderException.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Provider/Exception/DiscordIdentityProviderException.php b/src/Provider/Exception/DiscordIdentityProviderException.php index 3fd1342..979b78c 100644 --- a/src/Provider/Exception/DiscordIdentityProviderException.php +++ b/src/Provider/Exception/DiscordIdentityProviderException.php @@ -29,7 +29,7 @@ public static function clientException(ResponseInterface $response, $data) { return static::fromResponse( $response, - isset($data['message']) ? $data['message'] : json_encode($data) + $data['message'] ?? json_encode($data) ); }