1 | <?php |
||
37 | final class Bearer |
||
38 | { |
||
39 | const HEADER_AUTHENTICATION = 'Authentication'; |
||
40 | |||
41 | const AUTHENTICATION_SCHEMA = 'Bearer'; |
||
42 | |||
43 | /** @var AbstractProvider */ |
||
44 | private $provider; |
||
45 | |||
46 | /** @var AccessToken */ |
||
47 | private $accessToken; |
||
48 | |||
49 | /** @var callable */ |
||
50 | private $tokenCallback; |
||
51 | |||
52 | /** |
||
53 | * @param AbstractProvider $provider An OAuth2 Client Provider. |
||
54 | * @param AccessToken $accessToken Provide an initial (e.g. cached) access token. |
||
|
|||
55 | * @param callable $tokenCallback Will be called with a new AccessToken as a parameter if the AcessToken ever |
||
56 | * needs to be renewed. |
||
57 | */ |
||
58 | 13 | public function __construct( |
|
67 | |||
68 | /** |
||
69 | * __invoke |
||
70 | * @param callable $handler |
||
71 | * @return \Closure |
||
72 | */ |
||
73 | public function __invoke(callable $handler) |
||
80 | |||
81 | /** |
||
82 | * Authenticate |
||
83 | * @param RequestInterface $request |
||
84 | * @return RequestInterface |
||
85 | */ |
||
86 | 9 | protected function authenticate(RequestInterface $request) |
|
102 | |||
103 | /** |
||
104 | * checkAccessToken |
||
105 | * @return AccessToken |
||
106 | */ |
||
107 | 7 | private function checkAccessToken() |
|
117 | |||
118 | /** |
||
119 | * renewAccessToken |
||
120 | * @return void |
||
121 | */ |
||
122 | 5 | private function renewAccessToken() |
|
130 | } |
||
131 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.