From 82c9bda302e2e94f14ec33c662e0352876b4c245 Mon Sep 17 00:00:00 2001 From: atymic Date: Fri, 8 Oct 2021 09:32:52 +1100 Subject: [PATCH] chore: style fixes Co-authored-by: atymic --- src/Config.php | 8 +-- src/ConfigTrait.php | 7 ++- .../Helpers/ConfigRetrieverInterface.php | 5 +- src/Contracts/OAuth1/ProviderInterface.php | 3 +- src/Contracts/OAuth2/ProviderInterface.php | 3 +- src/Helpers/ConfigRetriever.php | 24 ++++----- src/OAuth1/AbstractProvider.php | 15 ++---- src/OAuth1/Server.php | 19 +++---- src/OAuth1/User.php | 3 +- src/OAuth2/AbstractProvider.php | 13 ++--- src/OAuth2/User.php | 3 +- src/SocialiteWasCalled.php | 50 ++++++++----------- tests/ManagerTestTrait.php | 9 ++-- tests/Stubs/OAuth1ServerStub.php | 20 +++----- 14 files changed, 72 insertions(+), 110 deletions(-) diff --git a/src/Config.php b/src/Config.php index 8bf2be01..a2822c47 100644 --- a/src/Config.php +++ b/src/Config.php @@ -15,10 +15,10 @@ class Config implements Contracts\ConfigInterface /** * Config constructor. * - * @param string $key - * @param string $secret - * @param string|callable $callbackUri - * @param array $additionalProviderConfig + * @param string $key + * @param string $secret + * @param string|callable $callbackUri + * @param array $additionalProviderConfig */ public function __construct($key, $secret, $callbackUri, array $additionalProviderConfig = []) { diff --git a/src/ConfigTrait.php b/src/ConfigTrait.php index 126d29c0..487a8ea8 100644 --- a/src/ConfigTrait.php +++ b/src/ConfigTrait.php @@ -13,7 +13,7 @@ trait ConfigTrait protected $config; /** - * @param \SocialiteProviders\Manager\Contracts\OAuth1\ProviderInterface|\SocialiteProviders\Manager\Contracts\OAuth2\ProviderInterface $config + * @param \SocialiteProviders\Manager\Contracts\OAuth1\ProviderInterface|\SocialiteProviders\Manager\Contracts\OAuth2\ProviderInterface $config */ public function setConfig(ConfigInterface $config) { @@ -36,9 +36,8 @@ public static function additionalConfigKeys() } /** - * @param string $key - * @param mixed $default - * + * @param string $key + * @param mixed $default * @return mixed|array */ protected function getConfig($key = null, $default = null) diff --git a/src/Contracts/Helpers/ConfigRetrieverInterface.php b/src/Contracts/Helpers/ConfigRetrieverInterface.php index 861b1291..4fd75aab 100644 --- a/src/Contracts/Helpers/ConfigRetrieverInterface.php +++ b/src/Contracts/Helpers/ConfigRetrieverInterface.php @@ -5,9 +5,8 @@ interface ConfigRetrieverInterface { /** - * @param string $providerName - * @param array $additionalConfigKeys - * + * @param string $providerName + * @param array $additionalConfigKeys * @return \SocialiteProviders\Manager\Contracts\ConfigInterface */ public function fromServices($providerName, array $additionalConfigKeys = []); diff --git a/src/Contracts/OAuth1/ProviderInterface.php b/src/Contracts/OAuth1/ProviderInterface.php index 734cc446..0e2f28cd 100644 --- a/src/Contracts/OAuth1/ProviderInterface.php +++ b/src/Contracts/OAuth1/ProviderInterface.php @@ -7,8 +7,7 @@ interface ProviderInterface { /** - * @param \SocialiteProviders\Manager\Contracts\ConfigInterface $config - * + * @param \SocialiteProviders\Manager\Contracts\ConfigInterface $config * @return $this */ public function setConfig(Config $config); diff --git a/src/Contracts/OAuth2/ProviderInterface.php b/src/Contracts/OAuth2/ProviderInterface.php index 593597fa..e2591e74 100644 --- a/src/Contracts/OAuth2/ProviderInterface.php +++ b/src/Contracts/OAuth2/ProviderInterface.php @@ -8,8 +8,7 @@ interface ProviderInterface extends SocialiteOauth2ProviderInterface { /** - * @param \SocialiteProviders\Manager\Contracts\ConfigInterface $config - * + * @param \SocialiteProviders\Manager\Contracts\ConfigInterface $config * @return $this */ public function setConfig(Config $config); diff --git a/src/Helpers/ConfigRetriever.php b/src/Helpers/ConfigRetriever.php index 9442a130..c68d8419 100644 --- a/src/Helpers/ConfigRetriever.php +++ b/src/Helpers/ConfigRetriever.php @@ -30,9 +30,8 @@ class ConfigRetriever implements ConfigRetrieverInterface protected $additionalConfigKeys; /** - * @param string $providerName - * @param array $additionalConfigKeys - * + * @param string $providerName + * @param array $additionalConfigKeys * @return \SocialiteProviders\Manager\Contracts\ConfigInterface */ public function fromServices($providerName, array $additionalConfigKeys = []) @@ -53,9 +52,8 @@ public function fromServices($providerName, array $additionalConfigKeys = []) } /** - * @param array $configKeys - * @param \Closure $keyRetrievalClosure - * + * @param array $configKeys + * @param \Closure $keyRetrievalClosure * @return array */ protected function getConfigItems(array $configKeys, Closure $keyRetrievalClosure) @@ -64,9 +62,8 @@ protected function getConfigItems(array $configKeys, Closure $keyRetrievalClosur } /** - * @param array $keys - * @param \Closure $keyRetrievalClosure - * + * @param array $keys + * @param \Closure $keyRetrievalClosure * @return array */ protected function retrieveItemsFromConfig(array $keys, Closure $keyRetrievalClosure) @@ -81,8 +78,7 @@ protected function retrieveItemsFromConfig(array $keys, Closure $keyRetrievalClo } /** - * @param string $key - * + * @param string $key * @return string|null * * @throws \SocialiteProviders\Manager\Exception\MissingConfigException @@ -105,8 +101,7 @@ protected function getFromServices($key) } /** - * @param string $providerName - * + * @param string $providerName * @return array * * @throws \SocialiteProviders\Manager\Exception\MissingConfigException @@ -132,8 +127,7 @@ protected function getConfigFromServicesArray($providerName) } /** - * @param string $key - * + * @param string $key * @return bool */ protected function isAdditionalConfig($key) diff --git a/src/OAuth1/AbstractProvider.php b/src/OAuth1/AbstractProvider.php index c5e41a4b..2c44f3fa 100644 --- a/src/OAuth1/AbstractProvider.php +++ b/src/OAuth1/AbstractProvider.php @@ -30,8 +30,7 @@ abstract class AbstractProvider extends BaseProvider implements ProviderInterfac protected $credentialsResponseBody; /** - * @param string $providerName - * + * @param string $providerName * @return string */ public static function serviceContainerKey($providerName) @@ -107,8 +106,7 @@ public function redirect() /** * Indicates that the provider should operate as stateless. * - * @param mixed $stateless - * + * @param mixed $stateless * @return $this */ public function stateless($stateless = true) @@ -121,8 +119,7 @@ public function stateless($stateless = true) /** * Set the scopes of the requested access. * - * @param array $scopes - * + * @param array $scopes * @return $this */ public function scopes(array $scopes) @@ -135,8 +132,7 @@ public function scopes(array $scopes) /** * Set the custom parameters of the request. * - * @param array $parameters - * + * @param array $parameters * @return $this */ public function with(array $parameters) @@ -147,8 +143,7 @@ public function with(array $parameters) } /** - * @param Config $config - * + * @param Config $config * @return $this */ public function setConfig(Config $config) diff --git a/src/OAuth1/Server.php b/src/OAuth1/Server.php index 3771b213..bfe036b2 100644 --- a/src/OAuth1/Server.php +++ b/src/OAuth1/Server.php @@ -39,11 +39,11 @@ abstract class Server extends BaseServer * the temporary credentials identifier as passed back by the server * and finally the verifier code. * - * @param \League\OAuth1\Client\Credentials\TemporaryCredentials $temporaryCredentials - * @param string $temporaryIdentifier - * @param string $verifier - * + * @param \League\OAuth1\Client\Credentials\TemporaryCredentials $temporaryCredentials + * @param string $temporaryIdentifier + * @param string $verifier * @return array + * * @throws \InvalidArgumentException */ public function getTokenCredentials(TemporaryCredentials $temporaryCredentials, $temporaryIdentifier, $verifier) @@ -84,8 +84,7 @@ public function getTokenCredentials(TemporaryCredentials $temporaryCredentials, /** * Set the scopes of the requested access. * - * @param array $scopes - * + * @param array $scopes * @return $this */ public function scopes(array $scopes) @@ -98,8 +97,7 @@ public function scopes(array $scopes) /** * Set the custom parameters of the request. * - * @param array $parameters - * + * @param array $parameters * @return $this */ public function with(array $parameters) @@ -112,9 +110,8 @@ public function with(array $parameters) /** * Format the given scopes. * - * @param array $scopes - * @param string $scopeSeparator - * + * @param array $scopes + * @param string $scopeSeparator * @return string */ protected function formatScopes(array $scopes, $scopeSeparator) diff --git a/src/OAuth1/User.php b/src/OAuth1/User.php index e348db6f..829119e2 100644 --- a/src/OAuth1/User.php +++ b/src/OAuth1/User.php @@ -20,8 +20,7 @@ class User extends BaseUser * * Might include things such as the token and refresh token * - * @param array $accessTokenResponseBody - * + * @param array $accessTokenResponseBody * @return $this */ public function setAccessTokenResponseBody(array $accessTokenResponseBody) diff --git a/src/OAuth2/AbstractProvider.php b/src/OAuth2/AbstractProvider.php index ef3a537d..0ec1e2c5 100644 --- a/src/OAuth2/AbstractProvider.php +++ b/src/OAuth2/AbstractProvider.php @@ -19,8 +19,7 @@ abstract class AbstractProvider extends BaseProvider implements ProviderInterfac protected $credentialsResponseBody; /** - * @param string $providerName - * + * @param string $providerName * @return string */ public static function serviceContainerKey($providerName) @@ -30,6 +29,7 @@ public static function serviceContainerKey($providerName) /** * @return \SocialiteProviders\Manager\OAuth2\User + * * @throws \Laravel\Socialite\Two\InvalidStateException */ public function user() @@ -57,8 +57,7 @@ public function user() /** * Get the access token from the token response body. * - * @param array $body - * + * @param array $body * @return string */ protected function parseAccessToken($body) @@ -69,8 +68,7 @@ protected function parseAccessToken($body) /** * Get the refresh token from the token response body. * - * @param array $body - * + * @param array $body * @return string */ protected function parseRefreshToken($body) @@ -81,8 +79,7 @@ protected function parseRefreshToken($body) /** * Get the expires in from the token response body. * - * @param array $body - * + * @param array $body * @return string */ protected function parseExpiresIn($body) diff --git a/src/OAuth2/User.php b/src/OAuth2/User.php index 69ff6908..8a304658 100644 --- a/src/OAuth2/User.php +++ b/src/OAuth2/User.php @@ -20,8 +20,7 @@ class User extends BaseUser * * Might include things such as the token and refresh token * - * @param array $accessTokenResponseBody - * + * @param array $accessTokenResponseBody * @return $this */ public function setAccessTokenResponseBody(array $accessTokenResponseBody) diff --git a/src/SocialiteWasCalled.php b/src/SocialiteWasCalled.php index cd761429..adec7d96 100644 --- a/src/SocialiteWasCalled.php +++ b/src/SocialiteWasCalled.php @@ -26,8 +26,8 @@ class SocialiteWasCalled private $configRetriever; /** - * @param \Illuminate\Contracts\Container\Container $app - * @param \SocialiteProviders\Manager\Contracts\Helpers\ConfigRetrieverInterface $configRetriever + * @param \Illuminate\Contracts\Container\Container $app + * @param \SocialiteProviders\Manager\Contracts\Helpers\ConfigRetrieverInterface $configRetriever */ public function __construct(Application $app, ConfigRetrieverInterface $configRetriever) { @@ -38,10 +38,9 @@ public function __construct(Application $app, ConfigRetrieverInterface $configRe /** * @param string $providerName 'meetup' * @param string $providerClass 'Your\Name\Space\ClassNameProvider' must extend - * either Laravel\Socialite\Two\AbstractProvider or - * Laravel\Socialite\One\AbstractProvider + * either Laravel\Socialite\Two\AbstractProvider or + * Laravel\Socialite\One\AbstractProvider * @param string $oauth1Server 'Your\Name\Space\ClassNameServer' must extend League\OAuth1\Client\Server\Server - * * @return void */ public function extendSocialite($providerName, $providerClass, $oauth1Server = null) @@ -69,11 +68,10 @@ function () use ($socialite, $providerName, $providerClass, $oauth1Server) { } /** - * @param \Laravel\Socialite\SocialiteManager $socialite - * @param string $providerName - * @param string $providerClass - * @param null|string $oauth1Server - * + * @param \Laravel\Socialite\SocialiteManager $socialite + * @param string $providerName + * @param string $providerClass + * @param null|string $oauth1Server * @return \Laravel\Socialite\One\AbstractProvider|\Laravel\Socialite\Two\AbstractProvider */ protected function buildProvider(SocialiteManager $socialite, $providerName, $providerClass, $oauth1Server) @@ -88,11 +86,10 @@ protected function buildProvider(SocialiteManager $socialite, $providerName, $pr /** * Build an OAuth 1 provider instance. * - * @param \Laravel\Socialite\SocialiteManager $socialite - * @param string $providerClass must extend Laravel\Socialite\One\AbstractProvider - * @param string $providerName - * @param string $oauth1Server must extend League\OAuth1\Client\Server\Server - * + * @param \Laravel\Socialite\SocialiteManager $socialite + * @param string $providerClass must extend Laravel\Socialite\One\AbstractProvider + * @param string $providerName + * @param string $oauth1Server must extend League\OAuth1\Client\Server\Server * @return \Laravel\Socialite\One\AbstractProvider */ protected function buildOAuth1Provider(SocialiteManager $socialite, $providerClass, $providerName, $oauth1Server) @@ -115,10 +112,9 @@ protected function buildOAuth1Provider(SocialiteManager $socialite, $providerCla /** * Build an OAuth 2 provider instance. * - * @param SocialiteManager $socialite - * @param string $providerClass must extend Laravel\Socialite\Two\AbstractProvider - * @param string $providerName - * + * @param SocialiteManager $socialite + * @param string $providerClass must extend Laravel\Socialite\Two\AbstractProvider + * @param string $providerName * @return \Laravel\Socialite\Two\AbstractProvider */ protected function buildOAuth2Provider(SocialiteManager $socialite, $providerClass, $providerName) @@ -135,9 +131,8 @@ protected function buildOAuth2Provider(SocialiteManager $socialite, $providerCla } /** - * @param string $providerClass - * @param string $providerName - * + * @param string $providerClass + * @param string $providerName * @return \SocialiteProviders\Manager\Contracts\ConfigInterface */ protected function getConfig(string $providerClass, string $providerName) @@ -150,8 +145,7 @@ protected function getConfig(string $providerClass, string $providerName) /** * Check if a server is given, which indicates that OAuth1 is used. * - * @param string $oauth1Server - * + * @param string $oauth1Server * @return bool */ private function isOAuth1($oauth1Server) @@ -160,9 +154,8 @@ private function isOAuth1($oauth1Server) } /** - * @param string $class - * @param string $baseClass - * + * @param string $class + * @param string $baseClass * @return void * * @throws \SocialiteProviders\Manager\Exception\InvalidArgumentException @@ -175,8 +168,7 @@ private function classExtends($class, $baseClass) } /** - * @param string $providerClass - * + * @param string $providerClass * @return void * * @throws \SocialiteProviders\Manager\Exception\InvalidArgumentException diff --git a/tests/ManagerTestTrait.php b/tests/ManagerTestTrait.php index 13dbe056..186a31f0 100644 --- a/tests/ManagerTestTrait.php +++ b/tests/ManagerTestTrait.php @@ -101,8 +101,7 @@ protected function config(): array } /** - * @param array $config - * + * @param array $config * @return array */ protected function oauth1FormattedConfig(array $config): array @@ -152,8 +151,7 @@ protected function oauth2ProviderStubClass(): string } /** - * @param string $stub - * + * @param string $stub * @return \Mockery\MockInterface */ protected function mockStub($stub): MockInterface @@ -162,8 +160,7 @@ protected function mockStub($stub): MockInterface } /** - * @param string $stub - * + * @param string $stub * @return string */ protected function fullStubClassName($stub): string diff --git a/tests/Stubs/OAuth1ServerStub.php b/tests/Stubs/OAuth1ServerStub.php index 3d8961aa..f222032c 100644 --- a/tests/Stubs/OAuth1ServerStub.php +++ b/tests/Stubs/OAuth1ServerStub.php @@ -52,9 +52,8 @@ public function urlUserDetails() * Take the decoded data from the user details URL and convert * it to a User object. * - * @param mixed $data - * @param TokenCredentials $tokenCredentials - * + * @param mixed $data + * @param TokenCredentials $tokenCredentials * @return \SocialiteProviders\Manager\OAuth1\User */ public function userDetails($data, TokenCredentials $tokenCredentials) @@ -66,9 +65,8 @@ public function userDetails($data, TokenCredentials $tokenCredentials) * Take the decoded data from the user details URL and extract * the user's UID. * - * @param mixed $data - * @param TokenCredentials $tokenCredentials - * + * @param mixed $data + * @param TokenCredentials $tokenCredentials * @return string|int */ public function userUid($data, TokenCredentials $tokenCredentials) @@ -80,9 +78,8 @@ public function userUid($data, TokenCredentials $tokenCredentials) * Take the decoded data from the user details URL and extract * the user's email. * - * @param mixed $data - * @param TokenCredentials $tokenCredentials - * + * @param mixed $data + * @param TokenCredentials $tokenCredentials * @return string */ public function userEmail($data, TokenCredentials $tokenCredentials) @@ -94,9 +91,8 @@ public function userEmail($data, TokenCredentials $tokenCredentials) * Take the decoded data from the user details URL and extract * the user's screen name. * - * @param mixed $data - * @param TokenCredentials $tokenCredentials - * + * @param mixed $data + * @param TokenCredentials $tokenCredentials * @return string */ public function userScreenName($data, TokenCredentials $tokenCredentials)