Skip to content

Commit 2bddabd

Browse files
committed
🚿 phpDoc cleanup
1 parent bbbf6e2 commit 2bddabd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+437
-314
lines changed

.phan/config.php

-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,5 @@
5353
],
5454
'suppress_issue_types' => [
5555
'PhanUndeclaredGlobalVariable', // happens in get-token examples
56-
'PhanAccessMethodInternal', // interface methods tagged as @internal
5756
],
5857
];

.phpdoc/template/base.html.twig

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
],
88
"social": [
99
{ "iconClass": "fab fa-github", "url": "https://github.com/chillerlan/php-oauth"},
10+
{ "iconClass": "fas fa-envelope-open-text", "url": "https://github.com/chillerlan/php-oauth/discussions"},
1011
]
1112
}
1213
%}

src/Core/AccessToken.php

+23-26
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* @author Smiley <[email protected]>
77
* @copyright 2017 Smiley
88
* @license MIT
9+
*
10+
* @filesource
911
*/
1012
declare(strict_types=1);
1113

@@ -18,71 +20,66 @@
1820
/**
1921
* Access token implementation for any OAuth version.
2022
*
21-
* @see https://datatracker.ietf.org/doc/html/rfc5849#section-2.3
22-
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-1.4
23-
*
24-
* // Oauth1
25-
* @property string|null $accessTokenSecret
26-
*
27-
* // Oauth2
28-
* @property array $scopes
29-
* @property string|null $refreshToken
30-
*
31-
* // common
32-
* @property string|null $accessToken
33-
* @property DateTime|DateInterval|int|null $expires
34-
* @property array $extraParams
35-
* @property string $provider
23+
* @link https://datatracker.ietf.org/doc/html/rfc5849#section-2.3
24+
* @link https://datatracker.ietf.org/doc/html/rfc6749#section-1.4
3625
*/
3726
final class AccessToken extends SettingsContainerAbstract{
3827

3928
/**
4029
* Denotes an unknown end of lifetime, such a token should be considered as expired.
30+
*
31+
* @var int
4132
*/
4233
public const EXPIRY_UNKNOWN = -9001;
4334

4435
/**
4536
* Denotes a token which never expires
37+
*
38+
* @var int
4639
*/
4740
public const NEVER_EXPIRES = -9002;
4841

4942
/**
5043
* Defines a maximum expiry period (1 year)
44+
*
45+
* @var int
5146
*/
5247
public const EXPIRY_MAX = (86400 * 365);
5348

5449
/**
55-
* The access token secret (OAuth1)
50+
* (magic) The oauth access token
5651
*/
57-
protected string|null $accessTokenSecret = null;
52+
protected string|null $accessToken = null;
5853

5954
/**
60-
* The oauth access token
55+
* (magic) The access token secret (OAuth1)
6156
*/
62-
protected string|null $accessToken = null;
57+
protected string|null $accessTokenSecret = null;
6358

6459
/**
65-
* An optional refresh token (OAuth2)
60+
* (magic) An optional refresh token (OAuth2)
6661
*/
6762
protected string|null $refreshToken = null;
6863

6964
/**
70-
* The token expiration date/time
65+
* (magic) The token expiration time
66+
*
67+
* The getter accepts: `DateTime|DateInterval|int|null`
7168
*/
7269
protected int $expires = self::EXPIRY_UNKNOWN;
7370

7471
/**
75-
* Additional token parameters supplied by the provider
72+
* (magic) The scopes that are attached to this token
7673
*/
77-
protected array $extraParams = [];
74+
protected array $scopes = [];
7875

7976
/**
80-
* The scopes that are attached to this token (OAuth2)
77+
* (magic) Additional token parameters supplied by the provider
8178
*/
82-
protected array $scopes = [];
79+
protected array $extraParams = [];
8380

8481
/**
85-
* The provider who issued this token
82+
* (magic) The provider that issued the token
8683
*/
8784
protected string|null $provider = null;
8885

src/Core/AuthenticatedUser.php

+11-15
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* @author smiley <[email protected]>
77
* @copyright 2024 smiley
88
* @license MIT
9+
*
10+
* @filesource
911
*/
1012
declare(strict_types=1);
1113

@@ -15,50 +17,44 @@
1517
use function intval, is_int, is_numeric, trim;
1618

1719
/**
18-
* A simple read-only container for user data responses from `OAuthInterface::me()`
20+
* A simple read-only container for user data responses
1921
*
20-
* @property string|null $handle
21-
* @property string|null $displayName
22-
* @property string|null $email
23-
* @property string|int|null $id
24-
* @property string|null $avatar
25-
* @property string|null $url
26-
* @property array $data
22+
* @see \chillerlan\OAuth\Core\UserInfo::me()
2723
*/
2824
final class AuthenticatedUser extends SettingsContainerAbstract{
2925

3026
/**
31-
* The user handle, account or tag name
27+
* (magic) The user handle, account or tag name
3228
*/
3329
protected string|null $handle = null;
3430

3531
/**
36-
* The user's display name
32+
* (magic) The user's display name
3733
*/
3834
protected string|null $displayName = null;
3935

4036
/**
41-
* The (main) email address
37+
* (magic) The (main) email address
4238
*/
4339
protected string|null $email = null;
4440

4541
/**
46-
* A user ID, may be string or integer
42+
* (magic) A user ID, may be string or integer
4743
*/
4844
protected string|int|null $id = null;
4945

5046
/**
51-
* An avatar URL
47+
* (magic) An avatar URL
5248
*/
5349
protected string|null $avatar = null;
5450

5551
/**
56-
* URL to the user profile
52+
* (magic) URL to the user profile
5753
*/
5854
protected string|null $url = null;
5955

6056
/**
61-
* The full user endpoint response
57+
* (magic) The full user endpoint response
6258
*/
6359
protected array $data = [];
6460

src/Core/CSRFStateMismatchException.php

+2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
use chillerlan\OAuth\OAuthException;
1515

1616
/**
17+
* Thrown on mismatching CSRF ("state") token
1718
*
19+
* @see \chillerlan\OAuth\Core\CSRFToken
1820
*/
1921
class CSRFStateMismatchException extends OAuthException{
2022

src/Core/CSRFToken.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
/**
1515
* Specifies the methods required for the OAuth2 CSRF token validation ("state parameter")
1616
*
17-
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.1
18-
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-10.12
17+
* @link https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.1
18+
* @link https://datatracker.ietf.org/doc/html/rfc6749#section-10.12
1919
*/
2020
interface CSRFToken{
2121

@@ -24,7 +24,6 @@ interface CSRFToken{
2424
* Throws a ProviderException if the given state is empty, unknown or doesn't match the known state.
2525
*
2626
* @throws \chillerlan\OAuth\Providers\ProviderException
27-
* @internal
2827
*/
2928
public function checkState(string|null $state = null):void;
3029

@@ -33,7 +32,6 @@ public function checkState(string|null $state = null):void;
3332
* in the local storage for later verification. Returns the updated array of parameters.
3433
*
3534
* @throws \chillerlan\OAuth\Providers\ProviderException
36-
* @internal
3735
*/
3836
public function setState(array $params):array;
3937

src/Core/ClientCredentials.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
/**
1515
* Indicates whether the provider is capable of the OAuth2 client credentials authentication flow.
1616
*
17-
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.4
17+
* @link https://datatracker.ietf.org/doc/html/rfc6749#section-4.4
1818
*/
1919
interface ClientCredentials{
2020

2121
/**
2222
* Obtains an OAuth2 client credentials token and returns an AccessToken
23+
*
24+
* @param string[]|null $scopes
2325
*/
2426
public function getClientCredentialsToken(array|null $scopes = null):AccessToken;
2527

src/Core/InvalidAccessTokenException.php

+4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
namespace chillerlan\OAuth\Core;
1313

1414
/**
15+
* Thrown when an access token is expired and cannot be refreshed
1516
*
17+
* @see \chillerlan\OAuth\Core\TokenRefresh
18+
* @see \chillerlan\OAuth\Core\OAuth1Provider::getRequestAuthorization()
19+
* @see \chillerlan\OAuth\Core\OAuth2Provider::getRequestAuthorization()
1620
*/
1721
class InvalidAccessTokenException extends UnauthorizedAccessException{
1822

src/Core/OAuth1Interface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ interface OAuth1Interface extends OAuthInterface{
2121
*
2222
* The $token (request token) supplied via `$_GET['oauth_token']` should be in the storage at this point.
2323
*
24-
* @see https://datatracker.ietf.org/doc/html/rfc5849#section-2.3
24+
* @link https://datatracker.ietf.org/doc/html/rfc5849#section-2.3
2525
*/
2626
public function getAccessToken(string $requestToken, string $verifier):AccessToken;
2727

0 commit comments

Comments
 (0)