Skip to content

Commit 407b9fc

Browse files
committed
Fix tests
1 parent 269f1e2 commit 407b9fc

File tree

19 files changed

+105
-61
lines changed

19 files changed

+105
-61
lines changed

.github/workflows/unit-tests.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,17 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
#Stable supported versions
18-
php: ['8.1', '8.2']
19-
symfony: ['5.4.*', '6.2.*']
20-
composer-flags: ['--prefer-stable']
21-
can-fail: [false]
22-
exclude:
23-
- php: '8.1'
24-
symfony: '6.2.*'
2517
include:
26-
# Lowest supported versions
27-
- php: '8.1'
28-
symfony: '5.4.*'
29-
composer-flags: '--prefer-stable --prefer-lowest'
18+
# Lowest Deps
19+
- php: 8.1
20+
symfony: 5.4.*
21+
composer-flags: '--prefer-stable'
22+
can-fail: false
23+
# Stable deps
24+
- php: 8.2
25+
symfony: 6.3.*
26+
composer-flags: '--prefer-stable'
3027
can-fail: false
31-
# Development versions
32-
- php: '8.3'
33-
symfony: '6.3.x-dev'
34-
composer-flags: ''
35-
can-fail: true
3628

3729
name: "PHP ${{ matrix.php }} - Symfony ${{ matrix.symfony }}${{ matrix.composer-flags != '' && format(' - Composer {0}', matrix.composer-flags) || '' }}"
3830

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ For implementation into Symfony projects, please see [bundle documentation](basi
1212

1313
## Requirements
1414

15-
* [PHP 7.2](http://php.net/releases/7_2_0.php) or greater
15+
* [PHP 8.1](http://php.net/releases/8_1_0.php) or greater
1616
* [Symfony 5.4](https://symfony.com/roadmap/5.4) or greater
1717

1818
## Installation

psalm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<psalm
33
errorLevel="1"
44
strictBinaryOperands="true"
5-
phpVersion="7.2"
5+
phpVersion="8.1"
66
allowStringToStandInForClass="true"
77
rememberPropertyAssignmentsAfterCall="false"
88
checkForThrowsInGlobalScope="true"

src/Command/CreateClientCommand.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use League\Bundle\OAuth2ServerBundle\Manager\ClientManagerInterface;
88
use League\Bundle\OAuth2ServerBundle\Model\AbstractClient;
9+
use League\Bundle\OAuth2ServerBundle\Model\ClientInterface;
910
use League\Bundle\OAuth2ServerBundle\ValueObject\Grant;
1011
use League\Bundle\OAuth2ServerBundle\ValueObject\RedirectUri;
1112
use League\Bundle\OAuth2ServerBundle\ValueObject\Scope;
@@ -117,20 +118,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int
117118
return 0;
118119
}
119120

120-
private function buildClientFromInput(InputInterface $input): AbstractClient
121+
private function buildClientFromInput(InputInterface $input): ClientInterface
121122
{
122123
$name = $input->getArgument('name');
123-
124-
/** @var string $identifier */
125-
$identifier = $input->getArgument('identifier') ?? hash('md5', random_bytes(16));
126-
124+
$identifier = (string) $input->getArgument('identifier') ?: hash('md5', random_bytes(16));
127125
$isPublic = $input->getOption('public');
128126

129127
if ($isPublic && null !== $input->getArgument('secret')) {
130128
throw new \InvalidArgumentException('The client cannot have a secret and be public.');
131129
}
132130

133-
/** @var string $secret */
134131
$secret = $isPublic ? null : $input->getArgument('secret') ?? hash('sha512', random_bytes(32));
135132

136133
/** @var AbstractClient $client */

src/Converter/UserConverter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ final class UserConverter implements UserConverterInterface
1212
{
1313
/**
1414
* @psalm-suppress DeprecatedMethod
15+
* @psalm-suppress UndefinedInterfaceMethod
1516
*/
1617
public function toLeague(?UserInterface $user): UserEntityInterface
1718
{

src/DBAL/Type/ImplodedArray.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ abstract class ImplodedArray extends TextType
2020
/**
2121
* @psalm-suppress MixedArgumentTypeCoercion
2222
*/
23-
public function convertToDatabaseValue($value, AbstractPlatform $platform): ?string
23+
public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform): ?string
2424
{
2525
if (!\is_array($value)) {
2626
throw new \LogicException('This type can only be used in combination with arrays.');
@@ -41,7 +41,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform): ?str
4141
/**
4242
* @psalm-return list<T>
4343
*/
44-
public function convertToPHPValue($value, AbstractPlatform $platform): array
44+
public function convertToPHPValue(mixed $value, AbstractPlatform $platform): array
4545
{
4646
if (null === $value) {
4747
return [];

src/Entity/Scope.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ final class Scope implements ScopeEntityInterface
1212
use EntityTrait;
1313

1414
#[\ReturnTypeWillChange]
15-
public function jsonSerialize()
15+
public function jsonSerialize(): mixed
1616
{
1717
return $this->getIdentifier();
1818
}

src/Event/AuthorizationRequestResolveEvent.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace League\Bundle\OAuth2ServerBundle\Event;
66

7-
use League\Bundle\OAuth2ServerBundle\Model\AbstractClient;
7+
use League\Bundle\OAuth2ServerBundle\Model\ClientInterface;
88
use League\Bundle\OAuth2ServerBundle\ValueObject\Scope;
99
use League\OAuth2\Server\RequestTypes\AuthorizationRequest;
1010
use Symfony\Component\HttpFoundation\Response;
@@ -27,7 +27,7 @@ final class AuthorizationRequestResolveEvent extends Event
2727
private $scopes;
2828

2929
/**
30-
* @var AbstractClient
30+
* @var ClientInterface
3131
*/
3232
private $client;
3333

@@ -49,7 +49,7 @@ final class AuthorizationRequestResolveEvent extends Event
4949
/**
5050
* @param Scope[] $scopes
5151
*/
52-
public function __construct(AuthorizationRequest $authorizationRequest, array $scopes, AbstractClient $client)
52+
public function __construct(AuthorizationRequest $authorizationRequest, array $scopes, ClientInterface $client)
5353
{
5454
$this->authorizationRequest = $authorizationRequest;
5555
$this->scopes = $scopes;
@@ -94,7 +94,7 @@ public function getGrantTypeId(): string
9494
/**
9595
* @psalm-mutation-free
9696
*/
97-
public function getClient(): AbstractClient
97+
public function getClient(): ClientInterface
9898
{
9999
return $this->client;
100100
}

src/LeagueOAuth2ServerBundle.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public function getContainerExtension(): ExtensionInterface
3333
return new LeagueOAuth2ServerExtension();
3434
}
3535

36+
/**
37+
* @psalm-suppress UndefinedMethod
38+
*/
3639
private function configureSecurityExtension(ContainerBuilder $container): void
3740
{
3841
/** @var SecurityExtension $extension */
@@ -61,6 +64,7 @@ private function configureDoctrineExtension(ContainerBuilder $container): void
6164
'league.oauth2_server.persistence.doctrine.enabled'
6265
)
6366
);
67+
6468
$container->addCompilerPass(new EncryptionKeyPass());
6569
}
6670
}

src/Manager/Null/AccessTokenManager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use League\Bundle\OAuth2ServerBundle\Manager\AccessTokenManagerInterface;
88
use League\Bundle\OAuth2ServerBundle\Model\AccessToken;
9+
use League\Bundle\OAuth2ServerBundle\Model\AccessTokenInterface;
910

1011
final class AccessTokenManager implements AccessTokenManagerInterface
1112
{
@@ -14,7 +15,7 @@ public function find(string $identifier): ?AccessToken
1415
return null;
1516
}
1617

17-
public function save(AccessToken $accessToken): void
18+
public function save(AccessTokenInterface $accessToken): void
1819
{
1920
}
2021

0 commit comments

Comments
 (0)