Skip to content

Commit

Permalink
style: Apply PHP-CS-Fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry authored and chalasr committed Dec 20, 2023
1 parent 1d105df commit d7cb055
Show file tree
Hide file tree
Showing 24 changed files with 7 additions and 136 deletions.
3 changes: 0 additions & 3 deletions src/DBAL/Type/Grant.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ final class Grant extends ImplodedArray
*/
private const NAME = 'oauth2_grant';

/**
* {@inheritdoc}
*/
public function getName(): string
{
return self::NAME;
Expand Down
10 changes: 0 additions & 10 deletions src/DBAL/Type/ImplodedArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform): ?str
}

/**
* {@inheritdoc}
*
* @param mixed $value
*
* @psalm-return list<T>
*/
public function convertToPHPValue($value, AbstractPlatform $platform): array
Expand All @@ -58,19 +54,13 @@ public function convertToPHPValue($value, AbstractPlatform $platform): array
return $this->convertDatabaseValues($values);
}

/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
{
$column['length'] = 65535;

return parent::getSQLDeclaration($column, $platform);
}

/**
* {@inheritdoc}
*/
public function requiresSQLCommentHint(AbstractPlatform $platform): bool
{
return true;
Expand Down
3 changes: 0 additions & 3 deletions src/DBAL/Type/RedirectUri.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ final class RedirectUri extends ImplodedArray
*/
private const NAME = 'oauth2_redirect_uri';

/**
* {@inheritdoc}
*/
public function getName(): string
{
return self::NAME;
Expand Down
3 changes: 0 additions & 3 deletions src/DBAL/Type/Scope.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ final class Scope extends ImplodedArray
*/
private const NAME = 'oauth2_scope';

/**
* {@inheritdoc}
*/
public function getName(): string
{
return self::NAME;
Expand Down
3 changes: 0 additions & 3 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@

final class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('league_oauth2_server');
Expand Down
9 changes: 0 additions & 9 deletions src/DependencyInjection/LeagueOAuth2ServerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
final class LeagueOAuth2ServerExtension extends Extension implements PrependExtensionInterface, CompilerPassInterface
{
/**
* {@inheritdoc}
*
* @return void
*
* @throws \Exception
Expand Down Expand Up @@ -73,17 +71,12 @@ public function load(array $configs, ContainerBuilder $container)
;
}

/**
* {@inheritdoc}
*/
public function getAlias(): string
{
return 'league_oauth2_server';
}

/**
* {@inheritdoc}
*
* @return void
*/
public function prepend(ContainerBuilder $container)
Expand All @@ -101,8 +94,6 @@ public function prepend(ContainerBuilder $container)
}

/**
* {@inheritdoc}
*
* @return void
*/
public function process(ContainerBuilder $container)
Expand Down
5 changes: 0 additions & 5 deletions src/Entity/Scope.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ final class Scope implements ScopeEntityInterface
{
use EntityTrait;

/**
* {@inheritdoc}
*
* @return mixed
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
Expand Down
5 changes: 0 additions & 5 deletions src/LeagueOAuth2ServerBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
final class LeagueOAuth2ServerBundle extends Bundle
{
/**
* {@inheritdoc}
*
* @return void
*/
public function build(ContainerBuilder $container)
Expand All @@ -30,9 +28,6 @@ public function build(ContainerBuilder $container)
$this->configureSecurityExtension($container);
}

/**
* {@inheritdoc}
*/
public function getContainerExtension(): ExtensionInterface
{
return new LeagueOAuth2ServerExtension();
Expand Down
2 changes: 1 addition & 1 deletion src/Model/RefreshToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class RefreshToken implements RefreshTokenInterface
/**
* @psalm-mutation-free
*/
public function __construct(string $identifier, \DateTimeInterface $expiry, ?AccessTokenInterface $accessToken = null)
public function __construct(string $identifier, \DateTimeInterface $expiry, AccessTokenInterface $accessToken = null)
{
$this->identifier = $identifier;
$this->expiry = $expiry;
Expand Down
6 changes: 0 additions & 6 deletions src/Repository/AccessTokenRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ public function __construct(
$this->scopeConverter = $scopeConverter;
}

/**
* {@inheritdoc}
*/
public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null)
{
/** @var int|string|null $userIdentifier */
Expand All @@ -59,9 +56,6 @@ public function getNewToken(ClientEntityInterface $clientEntity, array $scopes,
return $accessToken;
}

/**
* {@inheritdoc}
*/
public function persistNewAccessToken(AccessTokenEntityInterface $accessTokenEntity): void
{
$accessToken = $this->accessTokenManager->find($accessTokenEntity->getIdentifier());
Expand Down
11 changes: 0 additions & 11 deletions src/Repository/AuthCodeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,12 @@ public function __construct(
$this->scopeConverter = $scopeConverter;
}

/**
* {@inheritdoc}
*/
public function getNewAuthCode(): AuthCode
{
return new AuthCode();
}

/**
* {@inheritdoc}
*
* @return void
*/
public function persistNewAuthCode(AuthCodeEntityInterface $authCodeEntity)
Expand All @@ -67,9 +62,6 @@ public function persistNewAuthCode(AuthCodeEntityInterface $authCodeEntity)
$this->authorizationCodeManager->save($authorizationCode);
}

/**
* {@inheritdoc}
*/
public function revokeAuthCode($codeId): void
{
$authorizationCode = $this->authorizationCodeManager->find($codeId);
Expand All @@ -83,9 +75,6 @@ public function revokeAuthCode($codeId): void
$this->authorizationCodeManager->save($authorizationCode);
}

/**
* {@inheritdoc}
*/
public function isAuthCodeRevoked($codeId): bool
{
$authorizationCode = $this->authorizationCodeManager->find($codeId);
Expand Down
6 changes: 0 additions & 6 deletions src/Repository/ClientRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public function __construct(ClientManagerInterface $clientManager)
$this->clientManager = $clientManager;
}

/**
* {@inheritdoc}
*/
public function getClientEntity($clientIdentifier)
{
$client = $this->clientManager->find($clientIdentifier);
Expand All @@ -35,9 +32,6 @@ public function getClientEntity($clientIdentifier)
return $this->buildClientEntity($client);
}

/**
* {@inheritdoc}
*/
public function validateClient($clientIdentifier, $clientSecret, $grantType): bool
{
$client = $this->clientManager->find($clientIdentifier);
Expand Down
12 changes: 0 additions & 12 deletions src/Repository/NullAccessTokenRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@

final class NullAccessTokenRepository implements AccessTokenRepositoryInterface
{
/**
* {@inheritdoc}
*/
public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null): AccessTokenEntityInterface
{
/** @var int|string|null $userIdentifier */
Expand All @@ -28,25 +25,16 @@ public function getNewToken(ClientEntityInterface $clientEntity, array $scopes,
return $accessToken;
}

/**
* {@inheritdoc}
*/
public function persistNewAccessToken(AccessTokenEntityInterface $accessTokenEntity): void
{
// do nothing
}

/**
* {@inheritdoc}
*/
public function revokeAccessToken($tokenId): void
{
// do nothing
}

/**
* {@inheritdoc}
*/
public function isAccessTokenRevoked($tokenId): bool
{
return false;
Expand Down
6 changes: 0 additions & 6 deletions src/Repository/RefreshTokenRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,11 @@ public function __construct(
$this->accessTokenManager = $accessTokenManager;
}

/**
* {@inheritdoc}
*/
public function getNewRefreshToken()
{
return new RefreshTokenEntity();
}

/**
* {@inheritdoc}
*/
public function persistNewRefreshToken(RefreshTokenEntityInterface $refreshTokenEntity): void
{
$refreshToken = $this->refreshTokenManager->find($refreshTokenEntity->getIdentifier());
Expand Down
3 changes: 0 additions & 3 deletions src/Repository/ScopeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ public function __construct(
$this->eventDispatcher = $eventDispatcher;
}

/**
* {@inheritdoc}
*/
public function getScopeEntityByIdentifier($identifier)
{
$scope = $this->scopeManager->find($identifier);
Expand Down
3 changes: 0 additions & 3 deletions src/Repository/UserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ public function __construct(
$this->userConverter = $userConverter;
}

/**
* {@inheritdoc}
*/
public function getUserEntityByUserCredentials(
$username,
$password,
Expand Down
4 changes: 1 addition & 3 deletions src/Security/Authenticator/OAuth2Authenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function __construct(

public function supports(Request $request): ?bool
{
return 0 === strpos($request->headers->get('Authorization', ''), 'Bearer ');
return str_starts_with($request->headers->get('Authorization', ''), 'Bearer ');
}

public function start(Request $request, AuthenticationException $authException = null): Response
Expand All @@ -79,8 +79,6 @@ public function start(Request $request, AuthenticationException $authException =
}

/**
* {@inheritdoc}
*
* @return Passport
*/
public function doAuthenticate(Request $request) /* : Passport */
Expand Down
2 changes: 1 addition & 1 deletion src/Security/Exception/InsufficientScopesException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
class InsufficientScopesException extends OAuth2AuthenticationException
{
public static function create(?\Throwable $previous = null): self
public static function create(\Throwable $previous = null): self
{
return new self('Insufficient scopes.', 403, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Security/Exception/OAuth2AuthenticationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class OAuth2AuthenticationException extends AuthenticationException implements H
*/
private $statusCode;

public function __construct(string $message, int $statusCode, ?\Throwable $previous = null)
public function __construct(string $message, int $statusCode, \Throwable $previous = null)
{
$this->statusCode = $statusCode;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
class OAuth2AuthenticationFailedException extends OAuth2AuthenticationException
{
public static function create(string $message, ?\Throwable $previous = null): self
public static function create(string $message, \Throwable $previous = null): self
{
return new self($message, 401, $previous);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Acceptance/DoctrineCredentialsRevokerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private function buildRefreshToken(string $identifier, string $modify, AccessTok
);
}

private function buildAccessToken(string $identifier, string $modify, Client $client, ?string $userIdentifier = null): AccessToken
private function buildAccessToken(string $identifier, string $modify, Client $client, string $userIdentifier = null): AccessToken
{
return new AccessToken(
$identifier,
Expand All @@ -101,7 +101,7 @@ private function buildAccessToken(string $identifier, string $modify, Client $cl
);
}

private function buildAuthCode(string $identifier, string $modify, Client $client, ?string $userIdentifier = null): AuthorizationCode
private function buildAuthCode(string $identifier, string $modify, Client $client, string $userIdentifier = null): AuthorizationCode
{
return new AuthorizationCode(
$identifier,
Expand Down
Loading

0 comments on commit d7cb055

Please sign in to comment.