Skip to content

Commit d0147e4

Browse files
committed
ci: Resolve linter warnings
1 parent ee9946d commit d0147e4

File tree

8 files changed

+50
-35
lines changed

8 files changed

+50
-35
lines changed

src/Auth0Bundle.php

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@
1111
use Auth0\Symfony\Controllers\AuthenticationController;
1212
use Auth0\Symfony\Security\{Authenticator, Authorizer, UserProvider};
1313
use Auth0\Symfony\Stores\SessionStore;
14-
use LogicException;
1514
use OpenSSLAsymmetricKey;
1615
use Psr\Cache\CacheItemPoolInterface;
1716
use Psr\EventDispatcher\ListenerProviderInterface;
1817
use Psr\Http\Client\ClientInterface;
1918
use Psr\Http\Message\{RequestFactoryInterface, ResponseFactoryInterface, StreamFactoryInterface};
2019
use Symfony\Component\Config\Definition\Configurator\DefinitionConfigurator;
21-
use Symfony\Component\DependencyInjection\{ContainerBuilder, Reference};
22-
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
2320
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
21+
use Symfony\Component\DependencyInjection\{ContainerBuilder, Reference};
2422
use Symfony\Component\HttpKernel\Bundle\AbstractBundle;
2523

2624
final class Auth0Bundle extends AbstractBundle implements BundleInterface
@@ -31,45 +29,44 @@ public function configure(DefinitionConfigurator $definition): void
3129
}
3230

3331
/**
34-
* @param array<mixed> $config The configuration array.
32+
* @param array<mixed> $config The configuration array.
3533
* @param ContainerConfigurator $container The container configurator.
36-
* @param ContainerBuilder $builder The container builder.
34+
* @param ContainerBuilder $builder The container builder.
3735
*/
3836
public function loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): void
3937
{
4038
$sdkConfig = $config['sdk'] ?? [];
4139

4240
/**
43-
* @var array{strategy: string, domain: ?string, custom_domain: ?string, client_id: ?string, redirect_uri: ?string, client_secret: ?string, audiences: null|array<string>, organizations: array<string>|null, use_pkce: bool, scopes: array<string>|null, response_mode: string, response_type: string, token_algorithm: ?string, token_jwks_uri: ?string, token_max_age: ?int, token_leeway: ?int, token_cache: ?CacheItemPoolInterface, token_cache_ttl: int, http_client: null|string|ClientInterface, http_max_retries: int, http_request_factory: null|string|RequestFactoryInterface, http_response_factory: null|string|ResponseFactoryInterface, http_stream_factory: null|string|StreamFactoryInterface, http_telemetry: bool, session_storage: ?StoreInterface, session_storage_prefix: ?string, cookie_secret: ?string, cookie_domain: ?string, cookie_expires: int, cookie_path: string, cookie_secure: bool, cookie_same_site: ?string, persist_user: bool, persist_id_token: bool, persist_access_token: bool, persist_refresh_token: bool, transient_storage: ?StoreInterface, transient_storage_prefix: ?string, query_user_info: bool, management_token: ?string, management_token_cache: ?CacheItemPoolInterface, event_listener_provider: null|string|ListenerProviderInterface, client_assertion_signing_key: null|OpenSSLAsymmetricKey|string, client_assertion_signing_algorithm: string, pushed_authorization_request: bool, backchannel_logout_cache: ?CacheItemPoolInterface, backchannel_logout_expires: int} $sdkConfig
41+
* @var array{strategy: string, domain: ?string, custom_domain: ?string, client_id: ?string, redirect_uri: ?string, client_secret: ?string, audiences: null|array<string>, organizations: null|array<string>, use_pkce: bool, scopes: null|array<string>, response_mode: string, response_type: string, token_algorithm: ?string, token_jwks_uri: ?string, token_max_age: ?int, token_leeway: ?int, token_cache: ?CacheItemPoolInterface, token_cache_ttl: int, http_client: null|ClientInterface|string, http_max_retries: int, http_request_factory: null|RequestFactoryInterface|string, http_response_factory: null|ResponseFactoryInterface|string, http_stream_factory: null|StreamFactoryInterface|string, http_telemetry: bool, session_storage: ?StoreInterface, session_storage_prefix: ?string, cookie_secret: ?string, cookie_domain: ?string, cookie_expires: int, cookie_path: string, cookie_secure: bool, cookie_same_site: ?string, persist_user: bool, persist_id_token: bool, persist_access_token: bool, persist_refresh_token: bool, transient_storage: ?StoreInterface, transient_storage_prefix: ?string, query_user_info: bool, management_token: ?string, management_token_cache: ?CacheItemPoolInterface, event_listener_provider: null|ListenerProviderInterface|string, client_assertion_signing_key: null|OpenSSLAsymmetricKey|string, client_assertion_signing_algorithm: string, pushed_authorization_request: bool, backchannel_logout_cache: ?CacheItemPoolInterface, backchannel_logout_expires: int} $sdkConfig
4442
*/
45-
4643
$tokenCache = $sdkConfig['token_cache'] ?? 'cache.app';
4744

48-
if (! $tokenCache instanceOf CacheItemPoolInterface) {
45+
if (! $tokenCache instanceof CacheItemPoolInterface) {
4946
$tokenCache = new Reference($tokenCache);
5047
}
5148

5249
$managementTokenCache = $sdkConfig['management_token_cache'] ?? 'cache.app';
5350

54-
if (! $managementTokenCache instanceOf CacheItemPoolInterface) {
51+
if (! $managementTokenCache instanceof CacheItemPoolInterface) {
5552
$managementTokenCache = new Reference($managementTokenCache);
5653
}
5754

5855
$backchannelLogoutCache = $sdkConfig['backchannel_logout_cache'] ?? 'cache.app';
5956

60-
if (! $backchannelLogoutCache instanceOf CacheItemPoolInterface) {
57+
if (! $backchannelLogoutCache instanceof CacheItemPoolInterface) {
6158
$backchannelLogoutCache = new Reference($backchannelLogoutCache);
6259
}
6360

6461
$transientStorage = $sdkConfig['transient_storage'] ?? 'auth0.store_transient';
6562

66-
if (! $transientStorage instanceOf StoreInterface) {
63+
if (! $transientStorage instanceof StoreInterface) {
6764
$transientStorage = new Reference($transientStorage);
6865
}
6966

7067
$sessionStorage = $sdkConfig['session_storage'] ?? 'auth0.store_session';
7168

72-
if (! $sessionStorage instanceOf StoreInterface) {
69+
if (! $sessionStorage instanceof StoreInterface) {
7370
$sessionStorage = new Reference($sessionStorage);
7471
}
7572

@@ -78,31 +75,31 @@ public function loadExtension(array $config, ContainerConfigurator $container, C
7875

7976
$eventListenerProvider = $sdkConfig['event_listener_provider'] ?? null;
8077

81-
if (! $eventListenerProvider instanceOf ListenerProviderInterface && $eventListenerProvider !== '' && $eventListenerProvider !== null) {
78+
if (! $eventListenerProvider instanceof ListenerProviderInterface && '' !== $eventListenerProvider && null !== $eventListenerProvider) {
8279
$eventListenerProvider = new Reference($eventListenerProvider);
8380
}
8481

8582
$httpClient = $sdkConfig['http_client'] ?? null;
8683

87-
if (! $httpClient instanceOf ClientInterface && $httpClient !== '' && $httpClient !== null) {
84+
if (! $httpClient instanceof ClientInterface && '' !== $httpClient && null !== $httpClient) {
8885
$httpClient = new Reference($httpClient);
8986
}
9087

9188
$httpRequestFactory = $sdkConfig['http_request_factory'] ?? null;
9289

93-
if (! $httpRequestFactory instanceOf RequestFactoryInterface && $httpRequestFactory !== '' && $httpRequestFactory !== null) {
90+
if (! $httpRequestFactory instanceof RequestFactoryInterface && '' !== $httpRequestFactory && null !== $httpRequestFactory) {
9491
$httpRequestFactory = new Reference($httpRequestFactory);
9592
}
9693

9794
$httpResponseFactory = $sdkConfig['http_response_factory'] ?? null;
9895

99-
if (! $httpResponseFactory instanceOf ResponseFactoryInterface && $httpResponseFactory !== '' && $httpResponseFactory !== null) {
96+
if (! $httpResponseFactory instanceof ResponseFactoryInterface && '' !== $httpResponseFactory && null !== $httpResponseFactory) {
10097
$httpResponseFactory = new Reference($httpResponseFactory);
10198
}
10299

103100
$httpStreamFactory = $sdkConfig['http_stream_factory'] ?? null;
104101

105-
if (! $httpStreamFactory instanceOf StreamFactoryInterface && $httpStreamFactory !== '' && $httpStreamFactory !== null) {
102+
if (! $httpStreamFactory instanceof StreamFactoryInterface && '' !== $httpStreamFactory && null !== $httpStreamFactory) {
106103
$httpStreamFactory = new Reference($httpStreamFactory);
107104
}
108105

src/Controllers/AuthenticationController.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@
77
use Auth0\SDK\Auth0;
88
use Auth0\Symfony\Contracts\Controllers\AuthenticationControllerInterface;
99
use Auth0\Symfony\Security\Authenticator;
10-
use Psr\Cache\InvalidArgumentException;
11-
use LogicException;
1210
use Psr\Container\ContainerInterface;
1311
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
12+
use Symfony\Component\HttpFoundation\Exception\{BadRequestException, ConflictingHeadersException, SuspiciousOperationException};
1413
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
15-
use Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException;
16-
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
17-
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
1814
use Symfony\Component\Routing\RouterInterface;
1915
use Throwable;
2016

17+
use function is_array;
18+
use function is_string;
19+
2120
final class AuthenticationController extends AbstractController implements AuthenticationControllerInterface
2221
{
2322
public function __construct(
@@ -29,6 +28,8 @@ public function __construct(
2928

3029
/**
3130
* @psalm-suppress InternalMethod
31+
*
32+
* @param Request $request
3233
*/
3334
public function callback(Request $request): Response
3435
{

src/Controllers/BackchannelLogoutController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public function __construct(
2424

2525
/**
2626
* @psalm-suppress InternalMethod
27+
*
28+
* @param Request $request
2729
*/
2830
public function handle(Request $request): Response
2931
{

src/Models/User.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Symfony\Component\Security\Core\User\UserInterface as SymfonyUserInterface;
1111

1212
use function array_key_exists;
13+
use function is_array;
14+
use function is_bool;
15+
use function is_int;
1316
use function is_string;
1417

1518
class User implements SymfonyUserInterface, UserInterface
@@ -37,7 +40,7 @@ public function eraseCredentials(): void
3740

3841
/**
3942
* @param string $name
40-
* @param mixed $default
43+
* @param mixed $default
4144
*
4245
* @return mixed
4346
*/
@@ -163,7 +166,7 @@ public function getLastLoginAt(): ?DateTimeInterface
163166

164167
public function getLastPasswordResetAt(): ?DateTimeInterface
165168
{
166-
$lastPasswordResetAt =$this->data['last_password_reset'];
169+
$lastPasswordResetAt = $this->data['last_password_reset'];
167170

168171
if (! is_string($lastPasswordResetAt)) {
169172
return null;
@@ -305,7 +308,7 @@ public function getUserIdentifier(): string
305308

306309
/**
307310
* @param string $name
308-
* @param mixed $default
311+
* @param mixed $default
309312
*
310313
* @return mixed
311314
*/

src/Security/Authenticator.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
use Symfony\Component\Security\Http\Authenticator\Passport\{Passport, SelfValidatingPassport};
1717
use Throwable;
1818

19+
use function is_array;
20+
use function is_string;
21+
1922
final class Authenticator extends AbstractAuthenticator implements AuthenticatorInterface
2023
{
2124
/**
22-
* @param array<mixed> $configuration
23-
* @param Service $service
25+
* @param array<mixed> $configuration
26+
* @param Service $service
2427
* @param RouterInterface $router
2528
* @param LoggerInterface $logger
26-
* @return void
2729
*/
2830
public function __construct(
2931
public array $configuration,

src/Security/Authorizer.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
1515
use Symfony\Component\Security\Http\Authenticator\Passport\{Passport, SelfValidatingPassport};
1616

17+
use function is_string;
18+
1719
final class Authorizer extends AbstractAuthenticator implements AuthorizerInterface
1820
{
1921
/**
20-
* @param array<mixed> $configuration
21-
* @param Service $service
22+
* @param array<mixed> $configuration
23+
* @param Service $service
2224
* @param LoggerInterface $logger
23-
*
24-
* @return void
2525
*/
2626
public function __construct(
2727
private array $configuration,
@@ -32,6 +32,8 @@ public function __construct(
3232

3333
/**
3434
* @psalm-suppress InternalMethod
35+
*
36+
* @param Request $request
3537
*/
3638
public function authenticate(Request $request): Passport
3739
{
@@ -100,6 +102,8 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token,
100102

101103
/**
102104
* @psalm-suppress InternalMethod
105+
*
106+
* @param Request $request
103107
*/
104108
public function supports(Request $request): ?bool
105109
{

src/Security/UserProvider.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
1616
use Symfony\Component\Security\Core\User\{UserInterface as SymfonyUserInterface, UserProviderInterface as SymfonyUserProviderInterface};
1717

18+
use function is_array;
19+
1820
/**
1921
* @template-implements SymfonyUserProviderInterface<SymfonyUserInterface>
2022
*/
@@ -59,7 +61,7 @@ public function refreshUser(SymfonyUserInterface $user): SymfonyUserInterface
5961
}
6062

6163
/**
62-
* @param UserInterface|string $class
64+
* @param string|UserInterface $class
6365
*/
6466
public function supportsClass($class): bool
6567
{

src/Stores/SessionStore.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@
1111
use Symfony\Component\HttpFoundation\{Request, RequestStack};
1212
use Throwable;
1313

14+
use function gettype;
15+
use function is_array;
16+
use function is_string;
17+
1418
final class SessionStore implements StoreInterface
1519
{
1620
/**
17-
* @param string $namespace
18-
* @param RequestStack $requestStack
21+
* @param string $namespace
22+
* @param RequestStack $requestStack
1923
* @param LoggerInterface $logger
2024
*
2125
* @psalm-suppress DocblockTypeContradiction

0 commit comments

Comments
 (0)