Skip to content

Commit a5e9b87

Browse files
authored
Phpstan errors (#163)
1 parent fe679f9 commit a5e9b87

File tree

5 files changed

+21
-17
lines changed

5 files changed

+21
-17
lines changed

HS1.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515

1616
final class HS1 extends HMAC
1717
{
18-
protected function getHashAlgorithm(): string
18+
public function name(): string
1919
{
20-
return 'sha1';
20+
return 'HS1';
2121
}
2222

23-
public function name(): string
23+
protected function getHashAlgorithm(): string
2424
{
25-
return 'HS1';
25+
return 'sha1';
2626
}
2727
}

HS256_64.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@
1717

1818
final class HS256_64 extends HMAC
1919
{
20-
protected function getHashAlgorithm(): string
21-
{
22-
return 'sha256';
23-
}
24-
2520
public function sign(JWK $key, string $input): string
2621
{
2722
$signature = parent::sign($key, $input);
2823

29-
return \mb_substr($signature, 0, 8, '8bit');
24+
return mb_substr($signature, 0, 8, '8bit');
3025
}
3126

3227
public function name(): string
3328
{
3429
return 'HS256/64';
3530
}
31+
32+
protected function getHashAlgorithm(): string
33+
{
34+
return 'sha256';
35+
}
3636
}

RS1.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717

1818
final class RS1 extends RSA
1919
{
20+
public function name(): string
21+
{
22+
return 'RS1';
23+
}
24+
2025
protected function getAlgorithm(): string
2126
{
2227
return 'sha1';
@@ -26,9 +31,4 @@ protected function getSignatureMethod(): int
2631
{
2732
return JoseRSA::SIGNATURE_PKCS1;
2833
}
29-
30-
public function name(): string
31-
{
32-
return 'RS1';
33-
}
3434
}

Tests/HMACSignatureTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
/**
2222
* @group unit
2323
* @group NewAlgorithm
24+
*
25+
* @internal
26+
* @coversNothing
2427
*/
2528
class HMACSignatureTest extends TestCase
2629
{
@@ -53,13 +56,13 @@ public function hS256SignAndVerify()
5356

5457
$signature = $hmac->sign($key, $data);
5558

56-
static::assertEquals(\hex2bin('89f750759cb8ad93'), $signature);
59+
static::assertEquals(hex2bin('89f750759cb8ad93'), $signature);
5760
static::assertTrue($hmac->verify($key, $data, $signature));
5861
}
5962

6063
private function getKey(): JWK
6164
{
62-
return JWK::create([
65+
return new JWK([
6366
'kty' => 'oct',
6467
'k' => 'foo',
6568
]);

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"v1.0": "1.0.x-dev",
3232
"v1.1": "1.1.x-dev",
3333
"v1.2": "1.2.x-dev",
34+
"v1.3": "1.3.x-dev",
3435
"v2.0": "2.0.x-dev"
3536
}
3637
},

0 commit comments

Comments
 (0)