Skip to content

Commit 8cf941a

Browse files
authored
Merge pull request #1265 from abraham/null
Fix implicitly marking parameter as nullable
2 parents e15d6fb + 7e36cbf commit 8cf941a

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

Diff for: src/HmacSha1.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function getName()
3232
public function buildSignature(
3333
Request $request,
3434
Consumer $consumer,
35-
Token $token = null,
35+
?Token $token = null,
3636
): string {
3737
$signatureBase = $request->getSignatureBaseString();
3838

Diff for: src/Request.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,19 @@ public function __construct(
4040
/**
4141
* pretty much a helper function to set up the request
4242
*
43-
* @param Consumer $consumer
44-
* @param Token $token
45-
* @param string $httpMethod
46-
* @param string $httpUrl
47-
* @param array $parameters
43+
* @param Consumer $consumer
44+
* @param string $httpMethod
45+
* @param string $httpUrl
46+
* @param Token|null $token
47+
* @param array $parameters
4848
*
4949
* @return Request
5050
*/
5151
public static function fromConsumerAndToken(
5252
Consumer $consumer,
53-
Token $token = null,
5453
string $httpMethod,
5554
string $httpUrl,
55+
?Token $token = null,
5656
array $parameters = [],
5757
array $options = [],
5858
) {
@@ -246,12 +246,12 @@ public function __toString(): string
246246
/**
247247
* @param SignatureMethod $signatureMethod
248248
* @param Consumer $consumer
249-
* @param Token $token
249+
* @param Token|null $token
250250
*/
251251
public function signRequest(
252252
SignatureMethod $signatureMethod,
253253
Consumer $consumer,
254-
Token $token = null,
254+
?Token $token = null,
255255
) {
256256
$this->setParameter(
257257
'oauth_signature_method',
@@ -264,14 +264,14 @@ public function signRequest(
264264
/**
265265
* @param SignatureMethod $signatureMethod
266266
* @param Consumer $consumer
267-
* @param Token $token
267+
* @param Token|null $token
268268
*
269269
* @return string
270270
*/
271271
public function buildSignature(
272272
SignatureMethod $signatureMethod,
273273
Consumer $consumer,
274-
Token $token = null,
274+
?Token $token = null,
275275
): string {
276276
return $signatureMethod->buildSignature($this, $consumer, $token);
277277
}

Diff for: src/SignatureMethod.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ abstract public function getName();
3030
*
3131
* @param Request $request
3232
* @param Consumer $consumer
33-
* @param Token $token
33+
* @param Token|null $token
3434
*
3535
* @return string
3636
*/
3737
abstract public function buildSignature(
3838
Request $request,
3939
Consumer $consumer,
40-
Token $token = null,
40+
?Token $token = null,
4141
);
4242

4343
/**

Diff for: src/TwitterOAuth.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ public function oauth2(string $path, array $parameters = [])
205205
$url = sprintf('%s/%s', self::API_HOST, $path);
206206
$request = Request::fromConsumerAndToken(
207207
$this->consumer,
208-
$this->token,
209208
$method,
210209
$url,
210+
$this->token,
211211
$parameters,
212212
);
213213
$authorization =
@@ -606,9 +606,9 @@ private function oAuthRequest(
606606
) {
607607
$request = Request::fromConsumerAndToken(
608608
$this->consumer,
609-
$this->token,
610609
$method,
611610
$url,
611+
$this->token,
612612
$parameters,
613613
$options,
614614
);

0 commit comments

Comments
 (0)