Skip to content

Commit 41caa90

Browse files
committed
fix: #225: coding standard & stan
1 parent 3718242 commit 41caa90

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/Attribute/WithAccessTokenTTL.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace League\Bundle\OAuth2ServerBundle\Attribute;
46

57
#[\Attribute(\Attribute::TARGET_CLASS)]
68
class WithAccessTokenTTL
79
{
810
// we don't allow to pass directly \DateInterval, to not break symfony container dumping which require serializable object
9-
public function __construct(public readonly string|null $accessTokenTTL)
11+
public function __construct(public readonly ?string $accessTokenTTL)
1012
{
1113
}
1214
}

src/DependencyInjection/CompilerPass/GrantTypePass.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ public function process(ContainerBuilder $container): void
4949

5050
// read of accessTokenTTL from WithAccessTokenTTL attribute
5151
$withAccessTokenTTLAttributes = $refGrantClass->getAttributes(WithAccessTokenTTL::class);
52-
if (count($withAccessTokenTTLAttributes) > 0) {
52+
if (\count($withAccessTokenTTLAttributes) > 0) {
5353
// we only use first attribute, because WithAccessTokenTTL is not repeatable
54-
/** @var \ReflectionAttribute<WithAccessTokenTTL> $withAccessTokenTTLAttribute */
5554
$withAccessTokenTTLAttributeArguments = array_shift($withAccessTokenTTLAttributes)->getArguments();
5655
$attributes['accessTokenTTL'] = array_shift($withAccessTokenTTLAttributeArguments);
5756
}
@@ -67,7 +66,7 @@ public function process(ContainerBuilder $container): void
6766

6867
$definition->addMethodCall('enableGrantType', [
6968
new Reference($id),
70-
(is_string($accessTokenTTLValue))
69+
(\is_string($accessTokenTTLValue))
7170
? new Definition(\DateInterval::class, [$accessTokenTTLValue])
7271
: $accessTokenTTLValue,
7372
]);

tests/Integration/AuthorizationServerCustomGrantTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testAuthorizationServerHasOurCustomGrantEnabled(): void
4545
$this->assertGrantConfig('fake_legacy_grant', new \DateInterval('PT5H'), $enabledGrantTypes, $grantTypeAccessTokenTTL, FakeLegacyGrant::class);
4646
}
4747

48-
private function assertGrantConfig(string $grantId, \DateInterval|null $accessTokenTTL, array $enabledGrantTypes, array $grantTypeAccessTokenTTL, string|null $grantClass = null): void
48+
private function assertGrantConfig(string $grantId, ?\DateInterval $accessTokenTTL, array $enabledGrantTypes, array $grantTypeAccessTokenTTL, ?string $grantClass = null): void
4949
{
5050
$grantClass ??= $grantId;
5151

tests/TestKernel.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace League\Bundle\OAuth2ServerBundle\Tests;
66

77
use Doctrine\DBAL\Platforms\SqlitePlatform;
8-
use Doctrine\ORM\Mapping\Annotation;
98
use League\Bundle\OAuth2ServerBundle\Manager\AccessTokenManagerInterface;
109
use League\Bundle\OAuth2ServerBundle\Manager\AuthorizationCodeManagerInterface;
1110
use League\Bundle\OAuth2ServerBundle\Manager\ClientManagerInterface;
@@ -174,7 +173,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
174173
'authorization_server' => [
175174
'private_key' => '%env(PRIVATE_KEY_PATH)%',
176175
'encryption_key' => '%env(ENCRYPTION_KEY)%',
177-
'access_token_ttl' => 'PT2H' // to have a different value as league/oauth2-server lib
176+
'access_token_ttl' => 'PT2H', // to have a different value as league/oauth2-server lib
178177
],
179178
'resource_server' => $this->resourceServiceConfig ?? ['public_key' => '%env(PUBLIC_KEY_PATH)%'],
180179
'scopes' => [

0 commit comments

Comments
 (0)