Skip to content

Commit

Permalink
Drop legacy PHP support
Browse files Browse the repository at this point in the history
  • Loading branch information
bocharsky-bw authored and weaverryan committed Feb 1, 2023
1 parent e343b87 commit 6d99aa9
Show file tree
Hide file tree
Showing 68 changed files with 151 additions and 109 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
fail-fast: false
matrix:
# normal, highest, non-dev installs
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2']
php-version: ['7.4', '8.0', '8.1', '8.2']
composer-options: ['--prefer-stable']
dependency-versions: ['highest']
include:
# testing lowest php with lowest dependencies
- php-version: '7.2'
- php-version: '7.4'
dependency-versions: 'lowest'
composer-options: '--prefer-lowest'
# testing dev versions with highest PHP
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
],
"require": {
"php": ">=7.2.5",
"php": ">=7.4",
"symfony/framework-bundle": "^4.4|^5.0|^6.0",
"symfony/dependency-injection": "^4.4|^5.0|^6.0",
"symfony/routing": "^4.4|^5.0|^6.0",
Expand Down
6 changes: 2 additions & 4 deletions src/Client/ClientRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@

class ClientRegistry
{
/** @var ContainerInterface */
private $container;
private ContainerInterface $container;

/** @var array */
private $serviceMap;
private array $serviceMap;

/**
* ClientRegistry constructor.
Expand Down
9 changes: 3 additions & 6 deletions src/Client/OAuth2Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@ class OAuth2Client implements OAuth2ClientInterface
{
public const OAUTH2_SESSION_STATE_KEY = 'knpu.oauth2_client_state';

/** @var AbstractProvider */
private $provider;
private AbstractProvider $provider;

/** @var RequestStack */
private $requestStack;
private RequestStack $requestStack;

/** @var bool */
private $isStateless = false;
private bool $isStateless = false;

/**
* OAuth2Client constructor.
Expand Down
3 changes: 1 addition & 2 deletions src/Client/OAuth2PKCEClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class OAuth2PKCEClient extends OAuth2Client
{
public const VERIFIER_KEY = 'pkce_code_verifier';

/** @var RequestStack */
private $requestStack;
private RequestStack $requestStack;

public function __construct(AbstractProvider $provider,
RequestStack $requestStack)
Expand Down
4 changes: 1 addition & 3 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->end()
->end()
->validate()
->ifTrue(function ($v) {
return isset($v['http_client_options'], $v['http_client']) && !empty($v['http_client_options']);
})
->ifTrue(fn ($v) => isset($v['http_client_options'], $v['http_client']) && !empty($v['http_client_options']))
->thenInvalid('You cannot use both "http_client_options" and "http_client" at the same time under "knpu_oauth2_client".')
->end()
;
Expand Down
9 changes: 3 additions & 6 deletions src/DependencyInjection/KnpUOAuth2ClientExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,11 @@ class KnpUOAuth2ClientExtension extends Extension
/** @var bool */
private $checkExternalClassExistence;

/** @var array */
private $configurators = [];
private array $configurators = [];

/** @var array */
private $duplicateProviderTypes = [];
private array $duplicateProviderTypes = [];

/** @var array */
private static $supportedProviderTypes = [
private static array $supportedProviderTypes = [
'amazon' => AmazonProviderConfigurator::class,
'appid' => AppIdProviderConfigurator::class,
'apple' => AppleProviderConfigurator::class,
Expand Down
3 changes: 1 addition & 2 deletions src/DependencyInjection/ProviderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
*/
class ProviderFactory
{
/** @var UrlGeneratorInterface */
private $generator;
private UrlGeneratorInterface $generator;

/**
* ProviderFactory constructor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use KnpU\OAuth2ClientBundle\Client\Provider\AmazonClient;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class AmazonProviderConfigurator implements ProviderConfiguratorInterface
Expand Down Expand Up @@ -49,6 +50,6 @@ public function getProviderDisplayName()

public function getClientClass(array $config)
{
return 'KnpU\OAuth2ClientBundle\Client\Provider\AmazonClient';
return AmazonClient::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use KnpU\OAuth2ClientBundle\Client\Provider\AppIdClient;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

/**
Expand Down Expand Up @@ -47,7 +48,7 @@ public function getProviderClass(array $configuration)

public function getClientClass(array $config)
{
return 'KnpU\OAuth2ClientBundle\Client\Provider\AppIdClient';
return AppIdClient::class;
}

public function getProviderOptions(array $configuration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use KnpU\OAuth2ClientBundle\Client\Provider\AppleClient;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class AppleProviderConfigurator implements ProviderConfiguratorInterface, ProviderWithoutClientSecretConfiguratorInterface
Expand Down Expand Up @@ -41,7 +42,7 @@ public function getProviderClass(array $configuration)

public function getClientClass(array $config)
{
return 'KnpU\OAuth2ClientBundle\Client\Provider\AppleClient';
return AppleClient::class;
}

public function getProviderOptions(array $configuration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use KnpU\OAuth2ClientBundle\Client\Provider\Auth0Client;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class Auth0ProviderConfigurator implements ProviderConfiguratorInterface
Expand Down Expand Up @@ -65,6 +66,6 @@ public function getProviderDisplayName()

public function getClientClass(array $config)
{
return 'KnpU\OAuth2ClientBundle\Client\Provider\Auth0Client';
return Auth0Client::class;
}
}
11 changes: 4 additions & 7 deletions src/DependencyInjection/Providers/AzureProviderConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use KnpU\OAuth2ClientBundle\Client\Provider\AzureClient;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class AzureProviderConfigurator implements ProviderConfiguratorInterface, ProviderWithoutClientSecretConfiguratorInterface
Expand Down Expand Up @@ -90,15 +91,11 @@ public function buildConfiguration(NodeBuilder $node)
$node
->end()
->validate()
->ifTrue(function ($v) {
return empty($v['client_secret']) && empty($v['client_certificate_private_key']);
})
->ifTrue(fn ($v) => empty($v['client_secret']) && empty($v['client_certificate_private_key']))
->thenInvalid('You have to define either client_secret or client_certificate_private_key')
->end()
->validate()
->ifTrue(function ($v) {
return !empty($v['client_certificate_private_key']) && empty($v['client_certificate_thumbprint']);
})
->ifTrue(fn ($v) => !empty($v['client_certificate_private_key']) && empty($v['client_certificate_thumbprint']))
->thenInvalid('You have to define the client_certificate_thumbprint when using a certificate')
->end();
}
Expand Down Expand Up @@ -145,6 +142,6 @@ public function getProviderDisplayName()

public function getClientClass(array $config)
{
return 'KnpU\OAuth2ClientBundle\Client\Provider\AzureClient';
return AzureClient::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use KnpU\OAuth2ClientBundle\Client\Provider\BitbucketClient;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class BitbucketProviderConfigurator implements ProviderConfiguratorInterface
Expand Down Expand Up @@ -49,6 +50,6 @@ public function getProviderDisplayName()

public function getClientClass(array $config)
{
return 'KnpU\OAuth2ClientBundle\Client\Provider\BitbucketClient';
return BitbucketClient::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use KnpU\OAuth2ClientBundle\Client\Provider\BoxClient;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class BoxProviderConfigurator implements ProviderConfiguratorInterface
Expand Down Expand Up @@ -49,6 +50,6 @@ public function getProviderDisplayName()

public function getClientClass(array $config)
{
return 'KnpU\OAuth2ClientBundle\Client\Provider\BoxClient';
return BoxClient::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use KnpU\OAuth2ClientBundle\Client\Provider\BuddyClient;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class BuddyProviderConfigurator implements ProviderConfiguratorInterface
Expand Down Expand Up @@ -55,6 +56,6 @@ public function getProviderDisplayName()

public function getClientClass(array $config)
{
return 'KnpU\OAuth2ClientBundle\Client\Provider\BuddyClient';
return BuddyClient::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use KnpU\OAuth2ClientBundle\Client\Provider\BufferClient;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class BufferProviderConfigurator implements ProviderConfiguratorInterface
Expand Down Expand Up @@ -49,6 +50,6 @@ public function getProviderDisplayName()

public function getClientClass(array $config)
{
return 'KnpU\OAuth2ClientBundle\Client\Provider\BufferClient';
return BufferClient::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use KnpU\OAuth2ClientBundle\Client\Provider\CanvasLMSClient;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class CanvasLMSProviderConfigurator implements ProviderConfiguratorInterface
Expand Down Expand Up @@ -64,6 +65,6 @@ public function getProviderDisplayName()

public function getClientClass(array $config)
{
return 'KnpU\OAuth2ClientBundle\Client\Provider\CanvasLMSClient';
return CanvasLMSClient::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use KnpU\OAuth2ClientBundle\Client\Provider\CleverClient;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class CleverProviderConfigurator implements ProviderConfiguratorInterface
Expand Down Expand Up @@ -49,6 +50,6 @@ public function getProviderDisplayName()

public function getClientClass(array $config)
{
return 'KnpU\OAuth2ClientBundle\Client\Provider\CleverClient';
return CleverClient::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use KnpU\OAuth2ClientBundle\Client\Provider\DevianArtClient;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class DevianArtProviderConfigurator implements ProviderConfiguratorInterface
Expand Down Expand Up @@ -49,6 +50,6 @@ public function getProviderDisplayName()

public function getClientClass(array $config)
{
return 'KnpU\OAuth2ClientBundle\Client\Provider\DevianArtClient';
return DevianArtClient::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use KnpU\OAuth2ClientBundle\Client\Provider\DigitalOceanClient;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class DigitalOceanProviderConfigurator implements ProviderConfiguratorInterface
Expand Down Expand Up @@ -49,6 +50,6 @@ public function getProviderDisplayName()

public function getClientClass(array $config)
{
return 'KnpU\OAuth2ClientBundle\Client\Provider\DigitalOceanClient';
return DigitalOceanClient::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use KnpU\OAuth2ClientBundle\Client\Provider\DiscordClient;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class DiscordProviderConfigurator implements ProviderConfiguratorInterface
Expand Down Expand Up @@ -49,6 +50,6 @@ public function getProviderDisplayName()

public function getClientClass(array $config)
{
return 'KnpU\OAuth2ClientBundle\Client\Provider\DiscordClient';
return DiscordClient::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use KnpU\OAuth2ClientBundle\Client\Provider\DribbbleClient;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class DribbbleProviderConfigurator implements ProviderConfiguratorInterface
Expand Down Expand Up @@ -49,6 +50,6 @@ public function getProviderDisplayName()

public function getClientClass(array $config)
{
return 'KnpU\OAuth2ClientBundle\Client\Provider\DribbbleClient';
return DribbbleClient::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use KnpU\OAuth2ClientBundle\Client\Provider\DropboxClient;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class DropboxProviderConfigurator implements ProviderConfiguratorInterface
Expand Down Expand Up @@ -49,6 +50,6 @@ public function getProviderDisplayName()

public function getClientClass(array $config)
{
return 'KnpU\OAuth2ClientBundle\Client\Provider\DropboxClient';
return DropboxClient::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use KnpU\OAuth2ClientBundle\Client\Provider\DrupalClient;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class DrupalProviderConfigurator implements ProviderConfiguratorInterface
Expand Down Expand Up @@ -56,6 +57,6 @@ public function getProviderDisplayName()

public function getClientClass(array $config)
{
return 'KnpU\OAuth2ClientBundle\Client\Provider\DrupalClient';
return DrupalClient::class;
}
}
Loading

0 comments on commit 6d99aa9

Please sign in to comment.