Skip to content

Commit 69d7ec6

Browse files
committed
Update SignedUrl & improve CI to exactly test JWT v5 & v6
1 parent 7e4f247 commit 69d7ec6

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

.github/workflows/code_analysis.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,18 @@ jobs:
2424
- "7.4"
2525
- "8.0"
2626
- "8.1"
27+
- "8.2"
2728

28-
deps:
29-
- name: Lowest deps
30-
key: lowest
31-
arg: --prefer-lowest
29+
jwt:
30+
- name: JWT 5
31+
key: jtw5
32+
arg: '"firebase/php-jwt:^5.0"'
3233

33-
- name: Current deps
34-
key: current
35-
arg: ''
34+
- name: JWT 6
35+
key: jwt6
36+
arg: '"firebase/php-jwt:^6.0"'
3637

37-
name: ${{ matrix.actions.name }} on PHP ${{ matrix.php }} with ${{ matrix.deps.name }}
38+
name: ${{ matrix.actions.name }} on PHP ${{ matrix.php }} with ${{ matrix.jwt.name }}
3839
runs-on: ubuntu-latest
3940

4041
steps:
@@ -62,20 +63,19 @@ jobs:
6263
with:
6364
path: |
6465
${{ steps.composer-cache.outputs.dir }}
65-
key: ${{ runner.os }}-composer-data-${{ hashFiles('composer.json') }}-php-${{ matrix.php }}-${{ matrix.deps.name }}
66+
key: ${{ runner.os }}-composer-data-${{ hashFiles('composer.json') }}-php-${{ matrix.php }}-${{ matrix.jwt.name }}
6667

6768

6869
- uses: actions/cache@v2
6970
with:
7071
path: |
7172
**/composer.lock
72-
key: ${{ runner.os }}-composer-lock-${{ hashFiles('composer.json') }}-php-${{ matrix.php }}-${{ matrix.deps.name }}
73+
key: ${{ runner.os }}-composer-lock-${{ hashFiles('composer.json') }}-php-${{ matrix.php }}-${{ matrix.jwt.key }}
7374

7475

7576
- name: Install Composer
76-
run: composer update --no-progress ${{ matrix.deps.arg }}
77+
run: composer update --no-progress --with ${{ matrix.jwt.arg }}
7778

7879

7980
- name: Run job
80-
if: ${{ matrix.deps.key != 'lowest' && matrix.php != '8.1 }}
8181
run: ${{ matrix.actions.run }}

src/Plugin/SignedUrl.php

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

2626
/**
2727
* @phpstan-type ParsedUrl array{'scheme'?: string, 'host'?: string, 'port'?: int, 'user'?: string, 'pass'?: string, 'path'?: string, 'query'?: string, 'fragment'?: string}
28-
* @phpstan-type ClaimsSet array{'iss': string, 'aud': string|null, 'iat': int, 'exp': int, 'sub': string, 'meth': array<int, string>, 'mod': int, 'val': int}
2928
*/
3029
class SignedUrl implements Plugin
3130
{
@@ -243,7 +242,6 @@ public function verifyUrl(string $url, bool $allowRedirect = false): array
243242
public function verifyToken(string $token): array
244243
{
245244
try {
246-
/** @var ClaimsSet $payload */
247245
$payload = $this->jwt->decode($token);
248246
} catch (RuntimeException $e) {
249247
throw new SignedUrlVerificationException('JWT Token invalid', 0, $e);
@@ -364,7 +362,6 @@ protected function normalizeUrl(array $url): array
364362
{
365363
$url['path'] = ($url['path'] ?? '') === '' ? '/' : ($url['path'] ?? '');
366364
unset($url['fragment']);
367-
/** @var ParsedUrl $url (bypass PhpStan bug) */
368365
return $url;
369366
}
370367
}

0 commit comments

Comments
 (0)