Skip to content

Commit 6e50730

Browse files
Merge pull request #14 from sveldhuisen/master
Make OAuth 2 decorator compatible with PHP 8.4
2 parents 16f15a2 + 5ae9242 commit 6e50730

15 files changed

+47
-10
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
matrix:
1717
php-version:
18-
- "8.0"
18+
- "8.4"
1919

2020
dependencies:
2121
- "highest"
@@ -53,11 +53,9 @@ jobs:
5353
strategy:
5454
matrix:
5555
php-version:
56-
- "8.0"
57-
- "8.1"
56+
- "8.4"
5857

5958
dependencies:
60-
- "lowest"
6159
- "highest"
6260

6361
steps:
@@ -91,11 +89,9 @@ jobs:
9189
strategy:
9290
matrix:
9391
php-version:
94-
- "8.0"
95-
- "8.1"
92+
- "8.4"
9693

9794
dependencies:
98-
- "lowest"
9995
- "highest"
10096

10197
steps:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"sylius-labs/coding-standard": "^4.2",
2828
"symfony/cache": "^6.0",
2929
"symfony/http-client": "^6.0",
30-
"vimeo/psalm": "^4.26"
30+
"vimeo/psalm": "^6.9.4"
3131
},
3232
"provide": {
3333
"symfony/http-client-implementation": "^2.3.1"

psalm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
errorLevel="1"
55
xmlns="https://getpsalm.org/schema/config"
66
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
7-
phpVersion="8.1"
7+
phpVersion="8.4"
88
>
99
<projectFiles>
1010
<directory name="src"/>

src/Exception/OAuthException.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
/**
1010
* Represents errors during OAuth protocol.
11+
* @psalm-api
1112
*/
1213
class OAuthException extends RuntimeException implements OAuthExceptionInterface
1314
{

src/GrantType/AuthorizationCodeGrantType.php

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

1010
/**
1111
* Implementation of the OAuth authorization grant type.
12+
* @psalm-api
1213
*/
1314
class AuthorizationCodeGrantType implements RefreshableGrantTypeInterface
1415
{
@@ -50,6 +51,7 @@ public function __construct(
5051
*
5152
* @throws TransportExceptionInterface
5253
*/
54+
#[\Override]
5355
public function getTokens(): Tokens
5456
{
5557
$response = $this->client->request('POST', $this->tokenUrl, [
@@ -64,6 +66,7 @@ public function getTokens(): Tokens
6466
return $this->extractTokens($response);
6567
}
6668

69+
#[\Override]
6770
public function getRefreshTokenGrant(string $refreshToken): GrantTypeInterface
6871
{
6972
return new RefreshTokenGrantType($this->client, $this->tokenUrl, $refreshToken, $this->clientId, $this->clientSecret);

src/GrantType/ClientCredentialsGrantType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
/**
1111
* Implementation of the OAuth client credentials grant type.
12+
* @psalm-api
1213
*/
1314
class ClientCredentialsGrantType implements GrantTypeInterface
1415
{
@@ -45,6 +46,7 @@ public function __construct(
4546
*
4647
* @throws TransportExceptionInterface
4748
*/
49+
#[\Override]
4850
public function getTokens(): Tokens
4951
{
5052
$response = $this->client->request('POST', $this->tokenUrl, [

src/GrantType/PasswordGrantType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
/**
1111
* Implementation of the OAuth password grant type.
12+
* @psalm-api
1213
*/
1314
class PasswordGrantType implements GrantTypeInterface
1415
{
@@ -55,6 +56,7 @@ public function __construct(
5556
*
5657
* @throws TransportExceptionInterface
5758
*/
59+
#[\Override]
5860
public function getTokens(): Tokens
5961
{
6062
$parameters = [

src/GrantType/RefreshTokenGrantType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
/**
1111
* Implementation of the OAuth refresh token grant type.
12+
* @psalm-api
1213
*/
1314
class RefreshTokenGrantType implements GrantTypeInterface
1415
{
@@ -50,6 +51,7 @@ public function __construct(
5051
*
5152
* @throws TransportExceptionInterface
5253
*/
54+
#[\Override]
5355
public function getTokens(): Tokens
5456
{
5557
$response = $this->client->request('POST', $this->tokenUrl, [

src/GrantType/Tokens.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
/**
88
* Value object for an access token and a refresh token.
9+
* @psalm-api
910
*/
1011
class Tokens
1112
{

src/OAuthHttpClient.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,37 @@ public function __construct(
4040
$this->cache = new MemoryTokensCache();
4141
}
4242

43+
/**
44+
* @psalm-api
45+
*/
4346
public function setSigner(RequestSignerInterface $signer): self
4447
{
4548
$this->signer = $signer;
4649

4750
return $this;
4851
}
4952

53+
/**
54+
* @psalm-api
55+
*/
5056
public function setChecker(ResponseCheckerInterface $checker): self
5157
{
5258
$this->checker = $checker;
5359

5460
return $this;
5561
}
5662

63+
/**
64+
* @psalm-api
65+
*/
5766
public function setCache(TokensCacheInterface $cache): self
5867
{
5968
$this->cache = $cache;
6069

6170
return $this;
6271
}
6372

73+
#[\Override]
6474
public function request(string $method, string $url, array $options = []): ResponseInterface
6575
{
6676
$grant = $this->grant;
@@ -84,11 +94,13 @@ public function request(string $method, string $url, array $options = []): Respo
8494
throw new RuntimeException();
8595
}
8696

87-
public function stream($responses, float $timeout = null): ResponseStreamInterface
97+
#[\Override]
98+
public function stream($responses, ?float $timeout = null): ResponseStreamInterface
8899
{
89100
return $this->client->stream($responses, $timeout);
90101
}
91102

103+
#[\Override]
92104
public function withOptions(array $options): static
93105
{
94106
return new self($this->client->withOptions($options), $this->grant);

0 commit comments

Comments
 (0)