Skip to content

Commit

Permalink
Run cs-fixer on PHP 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
stloyd committed Nov 30, 2023
1 parent 9aeff89 commit 35c27be
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/OAuth/RequestDataStorage/SessionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private function getStorageKey($value): string
if (\is_array($value)) {
$storageKey = reset($value);
} elseif (\is_object($value)) {
$storageKey = \get_class($value);
$storageKey = $value::class;
} else {
$storageKey = $value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private function createOAuthToken(
OAuthToken $oldToken,
?UserInterface $user
): OAuthToken {
$tokenClass = \get_class($oldToken);
$tokenClass = $oldToken::class;
if (null !== $user) {
$token = new $tokenClass($data, $user->getRoles());
$token->setUser($user);
Expand Down
4 changes: 2 additions & 2 deletions src/Security/Core/User/EntityUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ public function refreshUser(UserInterface $user): UserInterface
{
$accessor = PropertyAccess::createPropertyAccessor();
$identifier = $this->properties['identifier'];
if (!$accessor->isReadable($user, $identifier) || !$this->supportsClass(\get_class($user))) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
if (!$accessor->isReadable($user, $identifier) || !$this->supportsClass($user::class)) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $user::class));
}

$userId = $accessor->getValue($user, $identifier);
Expand Down
4 changes: 2 additions & 2 deletions src/Security/Core/User/OAuthUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public function loadUserByOAuthUserResponse(UserResponseInterface $response): Us

public function refreshUser(UserInterface $user): UserInterface
{
if (!$this->supportsClass(\get_class($user))) {
throw new UnsupportedUserException(sprintf('Unsupported user class "%s"', \get_class($user)));
if (!$this->supportsClass($user::class)) {
throw new UnsupportedUserException(sprintf('Unsupported user class "%s"', $user::class));
}

// @phpstan-ignore-next-line Symfony <5.4 BC layer
Expand Down
6 changes: 3 additions & 3 deletions src/Security/Http/Authenticator/OAuthAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function refreshToken(OAuthToken $token): OAuthToken
if ($token->isExpired()) {
$expiredToken = $token;
if ($refreshToken = $expiredToken->getRefreshToken()) {
$tokenClass = \get_class($expiredToken);
$tokenClass = $expiredToken::class;
$token = new $tokenClass($resourceOwner->refreshAccessToken($refreshToken));
$token->setResourceOwnerName($expiredToken->getResourceOwnerName());
if (!$token->getRefreshToken()) {
Expand Down Expand Up @@ -213,7 +213,7 @@ public function recreateToken(OAuthToken $token, UserInterface $user = null): OA
{
$user = $user instanceof UserInterface ? $user : $token->getUser();

$tokenClass = \get_class($token);
$tokenClass = $token::class;
if ($user) {
$newToken = new $tokenClass(
$token->getRawToken(),
Expand Down Expand Up @@ -254,7 +254,7 @@ public function createAuthenticatedToken($passport, string $firewallName): Token
return $passport->getToken();
}

throw new \LogicException(sprintf('The first argument of "%s" must be instance of "%s", "%s" provided.', __METHOD__, SelfValidatedOAuthPassport::class, \get_class($passport)));
throw new \LogicException(sprintf('The first argument of "%s" must be instance of "%s", "%s" provided.', __METHOD__, SelfValidatedOAuthPassport::class, $passport::class));
}

public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ protected function createResourceOwner(
/** @var GenericOAuth2ResourceOwner $resourceOwner */
$resourceOwner = parent::createResourceOwner($options, $paths, $responses);

$reflection = new \ReflectionClass(\get_class($resourceOwner));
$reflection = new \ReflectionClass($resourceOwner::class);
$stateProperty = $reflection->getProperty('state');
$stateProperty->setAccessible(true);
$stateProperty->setValue($resourceOwner, $state ?: new State($this->state));
Expand Down
2 changes: 1 addition & 1 deletion tests/OAuth/RequestDataStorage/SessionStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function testFetchOtherThenToken(): void
->method('remove')
->with($key);

$data = $this->storage->fetch($this->resourceOwner, \get_class($class), 'state');
$data = $this->storage->fetch($this->resourceOwner, $class::class, 'state');
self::assertEquals(serialize($class), $data);
}
}

0 comments on commit 35c27be

Please sign in to comment.