Skip to content

Commit

Permalink
Merge pull request #199 from knpuniversity/forward-compat
Browse files Browse the repository at this point in the history
Forward compat with Symfony 4.4
  • Loading branch information
weaverryan authored Sep 23, 2019
2 parents 7c43e7b + 02e9020 commit 203237a
Show file tree
Hide file tree
Showing 81 changed files with 197 additions and 139 deletions.
2 changes: 1 addition & 1 deletion .flintci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
services:
phpcsfixer:
version: 1
version: 2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/composer.lock
/vendor/*
/tests/app/cache
/.php_cs.cache
38 changes: 0 additions & 38 deletions .php_cs

This file was deleted.

30 changes: 30 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

if (!file_exists(__DIR__.'/src')) {
exit(0);
}

$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
;

return PhpCsFixer\Config::create()
->setRules(array(
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'protected_to_private' => false,
'semicolon_after_instruction' => false,
'header_comment' => [
'header' => <<<EOF
OAuth2 Client Bundle
Copyright (c) KnpUniversity <http://knpuniversity.com/>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF
]
))
->setRiskyAllowed(true)
->setFinder($finder)
;
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ install: composer update --prefer-dist $COMPOSER_FLAGS
# Fail CI if repo is in dirty state after bin/update_readme
before_script: ./bin/update_readme && git diff --exit-code README.md

script: ./vendor/bin/phpunit
script: ./vendor/bin/simple-phpunit
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"symfony/dependency-injection": "^3.4|^4.0",
"symfony/routing": "^3.4|^4.0",
"symfony/http-foundation": "^3.4|^4.0",
"league/oauth2-client": "^1.0|^2.0"
"league/oauth2-client": "^1.0|^2.0",
"symfony/phpunit-bridge": "^4.3"
},
"autoload": {
"psr-4": { "KnpU\\OAuth2ClientBundle\\": "src/" }
Expand All @@ -27,9 +28,9 @@
},
"require-dev": {
"league/oauth2-facebook": "^1.1|^2.0",
"phpunit/phpunit": "^7.5",
"symfony/security-guard": "^3.4|^4.0",
"symfony/yaml": "^3.4|^4.0"
"symfony/yaml": "^3.4|^4.0",
"phpspec/prophecy": "^1.8"
},
"suggest": {
"symfony/security-guard": "For integration with Symfony's Guard Security layer"
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<ini name="intl.default_locale" value="en" />
<ini name="intl.error_level" value="0" />
<ini name="memory_limit" value="-1" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0" />
</php>

<testsuites>
Expand Down
3 changes: 2 additions & 1 deletion src/Client/ClientRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ClientRegistry
* ClientRegistry constructor.
*
* @param ContainerInterface $container
* @param array $serviceMap
* @param array $serviceMap
*/
public function __construct(ContainerInterface $container, array $serviceMap)
{
Expand All @@ -36,6 +36,7 @@ public function __construct(ContainerInterface $container, array $serviceMap)
* Easy accessor for client objects.
*
* @param string $key
*
* @return OAuth2Client
*/
public function getClient($key)
Expand Down
8 changes: 5 additions & 3 deletions src/Client/OAuth2Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class OAuth2Client implements OAuth2ClientInterface
* OAuth2Client constructor.
*
* @param AbstractProvider $provider
* @param RequestStack $requestStack
* @param RequestStack $requestStack
*/
public function __construct(AbstractProvider $provider, RequestStack $requestStack)
{
Expand All @@ -57,6 +57,7 @@ public function setAsStateless()
*
* @param array $scopes The scopes you want (leave empty to use default)
* @param array $options Extra options to pass to the "Provider" class
*
* @return RedirectResponse
*/
public function redirect(array $scopes = [], array $options = [])
Expand Down Expand Up @@ -85,7 +86,7 @@ public function redirect(array $scopes = [], array $options = [])
*
* @throws InvalidStateException
* @throws MissingAuthorizationCodeException
* @throws IdentityProviderException If token cannot be fetched
* @throws IdentityProviderException If token cannot be fetched
*/
public function getAccessToken()
{
Expand All @@ -112,6 +113,7 @@ public function getAccessToken()
* Returns the "User" information (called a resource owner).
*
* @param AccessToken $accessToken
*
* @return \League\OAuth2\Client\Provider\ResourceOwnerInterface
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down Expand Up @@ -159,7 +161,7 @@ private function getCurrentRequest()
}

/**
* @return null|\Symfony\Component\HttpFoundation\Session\SessionInterface
* @return \Symfony\Component\HttpFoundation\Session\SessionInterface|null
*/
private function getSession()
{
Expand Down
4 changes: 3 additions & 1 deletion src/Client/OAuth2ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function setAsStateless();
*
* @param array $scopes The scopes you want (leave empty to use default)
* @param array $options Extra options to pass to the "Provider" class
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function redirect(array $scopes, array $options);
Expand All @@ -36,14 +37,15 @@ public function redirect(array $scopes, array $options);
*
* @throws \KnpU\OAuth2ClientBundle\Exception\InvalidStateException
* @throws \KnpU\OAuth2ClientBundle\Exception\MissingAuthorizationCodeException
* @throws \League\OAuth2\Client\Provider\Exception\IdentityProviderException If token cannot be fetched
* @throws \League\OAuth2\Client\Provider\Exception\IdentityProviderException If token cannot be fetched
*/
public function getAccessToken();

/**
* Returns the "User" information (called a resource owner).
*
* @param AccessToken $accessToken
*
* @return \League\OAuth2\Client\Provider\ResourceOwnerInterface
*/
public function fetchUserFromToken(AccessToken $accessToken);
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/AmazonClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class AmazonClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return AmazonResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/Auth0Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Auth0Client extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return Auth0ResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/AzureClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class AzureClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return AzureResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/BitbucketClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class BitbucketClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return BitbucketResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/BoxClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class BoxClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return BoxResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/BufferClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class BufferClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return BufferUser
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/CanvasLMSClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class CanvasLMSClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return CanvasLMSResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/CleverClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class CleverClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return CleverUser
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/DevianArtClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class DevianArtClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return DeviantArtResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/DigitalOceanClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class DigitalOceanClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return DigitalOceanResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/DiscordClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class DiscordClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return DiscordResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/DribbbleClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class DribbbleClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return DribbbleResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/DropboxClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class DropboxClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return DropboxResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/DrupalClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class DrupalClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return DrupalResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/ElanceClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ElanceClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return ElanceResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/EveOnlineClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class EveOnlineClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return EveOnlineResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/EventbriteClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class EventbriteClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return EventbriteResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/FacebookClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class FacebookClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return FacebookUser
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/FitbitClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class FitbitClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return FitbitUser
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/FoursquareClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class FoursquareClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return FoursquareResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/GeocachingClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class GeocachingClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return GeocachingResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/GithubClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class GithubClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return GithubResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/GitlabClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class GitlabClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return GitlabResourceOwner
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
1 change: 1 addition & 0 deletions src/Client/Provider/GoogleClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class GoogleClient extends OAuth2Client
{
/**
* @param AccessToken $accessToken
*
* @return GoogleUser
*/
public function fetchUserFromToken(AccessToken $accessToken)
Expand Down
Loading

0 comments on commit 203237a

Please sign in to comment.