Skip to content

Commit a094e60

Browse files
committed
feature #180 Support Doctrine ORM 3.0 (wmouwen)
This PR was squashed before being merged into the 0.4-dev branch. Discussion ---------- Support Doctrine ORM 3.0 Doctrine ORM v3.0.0 has been released. https://github.com/doctrine/orm/releases/tag/3.0.0 Upgrade the minimal version of the ORM to v2.14, allow v3.0 as well. This matches the version requirement as used by [doctrine/doctrine-fixtures-bundle](https://github.com/doctrine/DoctrineFixturesBundle/blob/6c3253bfd071b57fac9a5b02cd7b1e5b9803148e/composer.json#L26). Update the GitHub workflows to test against v2.14, v2.18 and v3.0. Commits ------- 0cd73a8 Support Doctrine ORM 3.0
2 parents e4d5221 + 0cd73a8 commit a094e60

File tree

7 files changed

+41
-81
lines changed

7 files changed

+41
-81
lines changed

.github/workflows/static-analysis.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,24 @@ jobs:
1111
static-analysis:
1212
name: "static analysis"
1313
runs-on: "ubuntu-latest"
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
doctrine-orm: ['2.14.*', '2.18.*', '3.0.*']
18+
composer-flags: ['--prefer-stable']
19+
1420
steps:
1521
- name: "checkout"
1622
uses: "actions/checkout@v4"
1723

1824
- name: "build the environment"
1925
run: "dev/bin/docker-compose build"
2026

27+
- name: "require specific Doctrine ORM version"
28+
run: "dev/bin/php composer require --ansi ${{ matrix.composer-flags }} doctrine/orm:${{ matrix.doctrine-orm }}"
29+
2130
- name: "install dependencies"
22-
run: "dev/bin/php composer update --prefer-stable"
31+
run: "dev/bin/php composer update --ansi ${{ matrix.composer-flags }}"
2332

2433
- name: "run static analysis"
2534
run: "dev/bin/php psalm --shepherd --stats"

.github/workflows/unit-tests.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ jobs:
1616
matrix:
1717
php: ['8.1', '8.2', '8.3']
1818
symfony: ['5.4.*', '6.4.*', '7.0.*']
19+
doctrine-orm: ['2.14.*', '2.18.*', '3.0.*']
1920
composer-flags: ['--prefer-stable']
2021
can-fail: [false]
2122
exclude:
2223
- php: "8.1"
2324
symfony: "7.0.*"
25+
- doctrine-orm: "2.14.*"
26+
symfony: "6.4.*"
27+
- doctrine-orm: "2.14.*"
28+
symfony: "7.0.*"
2429

25-
name: "PHP ${{ matrix.php }} - Symfony ${{ matrix.symfony }}${{ matrix.composer-flags != '' && format(' - Composer {0}', matrix.composer-flags) || '' }}"
30+
name: "PHP ${{ matrix.php }} - Doctrine ${{ matrix.doctrine-orm }} - Symfony ${{ matrix.symfony }}${{ matrix.composer-flags != '' && format(' - Composer {0}', matrix.composer-flags) || '' }}"
2631

2732
env:
2833
SYMFONY_REQUIRE: ${{ matrix.symfony }}
@@ -34,6 +39,9 @@ jobs:
3439
- name: "build the PHP environment"
3540
run: "dev/bin/docker-compose build --build-arg PHP_VERSION=${{ matrix.php }} --build-arg XDEBUG_VERSION='3.3.1' php"
3641

42+
- name: "require specific Doctrine ORM version"
43+
run: "dev/bin/php composer require --ansi ${{ matrix.composer-flags }} doctrine/orm:${{ matrix.doctrine-orm }}"
44+
3745
- name: "install dependencies"
3846
run: "dev/bin/php composer update --ansi ${{ matrix.composer-flags }}"
3947

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": "^8.1",
2020
"doctrine/doctrine-bundle": "^2.0.8",
21-
"doctrine/orm": "^2.7.1",
21+
"doctrine/orm": "^2.14|^3.0",
2222
"league/oauth2-server": "^8.3",
2323
"nyholm/psr7": "^1.4",
2424
"psr/http-factory": "^1.0",

src/Model/AbstractClient.php

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,45 +15,21 @@
1515
*/
1616
abstract class AbstractClient implements ClientInterface
1717
{
18-
/**
19-
* @var string
20-
*/
21-
private $name;
18+
private string $name;
19+
protected string $identifier;
20+
private ?string $secret;
2221

23-
/**
24-
* @var string
25-
*/
26-
protected $identifier;
22+
/** @var list<RedirectUri> */
23+
private array $redirectUris = [];
2724

28-
/**
29-
* @var string|null
30-
*/
31-
private $secret;
25+
/** @var list<Grant> */
26+
private array $grants = [];
3227

33-
/**
34-
* @var list<RedirectUri>
35-
*/
36-
private $redirectUris = [];
28+
/** @var list<Scope> */
29+
private array $scopes = [];
3730

38-
/**
39-
* @var list<Grant>
40-
*/
41-
private $grants = [];
42-
43-
/**
44-
* @var list<Scope>
45-
*/
46-
private $scopes = [];
47-
48-
/**
49-
* @var bool
50-
*/
51-
private $active = true;
52-
53-
/**
54-
* @var bool
55-
*/
56-
private $allowPlainTextPkce = false;
31+
private bool $active = true;
32+
private bool $allowPlainTextPkce = false;
5733

5834
/**
5935
* @psalm-mutation-free
@@ -165,7 +141,7 @@ public function setActive(bool $active): ClientInterface
165141
*/
166142
public function isConfidential(): bool
167143
{
168-
return !empty($this->secret);
144+
return null !== $this->secret && '' !== $this->secret;
169145
}
170146

171147
/**

src/Model/RefreshToken.php

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,10 @@
66

77
class RefreshToken implements RefreshTokenInterface
88
{
9-
/**
10-
* @var string
11-
*/
12-
private $identifier;
13-
14-
/**
15-
* @var \DateTimeInterface
16-
*/
17-
private $expiry;
18-
19-
/**
20-
* @var AccessTokenInterface|null
21-
*/
22-
private $accessToken;
23-
24-
/**
25-
* @var bool
26-
*/
27-
private $revoked = false;
9+
private string $identifier;
10+
private \DateTimeInterface $expiry;
11+
private ?AccessTokenInterface $accessToken;
12+
private bool $revoked = false;
2813

2914
/**
3015
* @psalm-mutation-free

src/Security/Authenticator/OAuth2Authenticator.php

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,10 @@ final class OAuth2Authenticator implements AuthenticatorInterface, Authenticatio
3636
*/
3737
use ForwardCompatAuthenticatorTrait;
3838

39-
/**
40-
* @var HttpMessageFactoryInterface
41-
*/
42-
private $httpMessageFactory;
43-
44-
/**
45-
* @var ResourceServer
46-
*/
47-
private $resourceServer;
48-
49-
/**
50-
* @var UserProviderInterface
51-
*/
52-
private $userProvider;
53-
54-
/**
55-
* @var string
56-
*/
57-
private $rolePrefix;
39+
private HttpMessageFactoryInterface $httpMessageFactory;
40+
private ResourceServer $resourceServer;
41+
private UserProviderInterface $userProvider;
42+
private string $rolePrefix;
5843

5944
public function __construct(
6045
HttpMessageFactoryInterface $httpMessageFactory,

src/Security/Exception/OAuth2AuthenticationException.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
*/
1313
class OAuth2AuthenticationException extends AuthenticationException implements HttpExceptionInterface
1414
{
15-
/**
16-
* @var int
17-
*/
18-
private $statusCode;
15+
private int $statusCode;
1916

2017
public function __construct(string $message, int $statusCode, ?\Throwable $previous = null)
2118
{

0 commit comments

Comments
 (0)