Skip to content

Commit

Permalink
Avoid setting null when an string is required
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgarlag committed Apr 22, 2024
1 parent 3482a76 commit f9c0b4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Repository/AccessTokenRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public function getNewToken(ClientEntityInterface $clientEntity, array $scopes,
/** @var int|string|null $userIdentifier */
$accessToken = new AccessTokenEntity();
$accessToken->setClient($clientEntity);
$accessToken->setUserIdentifier($userIdentifier);
if (null !== $userIdentifier) {
$accessToken->setUserIdentifier((string) $userIdentifier);
}

foreach ($scopes as $scope) {
$accessToken->addScope($scope);
Expand Down
2 changes: 1 addition & 1 deletion tests/TestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static function generateJwtToken(AccessTokenModel $accessToken): string
$accessTokenEntity->setIdentifier($accessToken->getIdentifier());
$accessTokenEntity->setExpiryDateTime($accessToken->getExpiry());
$accessTokenEntity->setClient($clientEntity);
$accessTokenEntity->setUserIdentifier($accessToken->getUserIdentifier());
$accessTokenEntity->setUserIdentifier((string) $accessToken->getUserIdentifier());

foreach ($accessToken->getScopes() as $scope) {
$scopeEntity = new ScopeEntity();
Expand Down

0 comments on commit f9c0b4f

Please sign in to comment.