Skip to content

feat: Add Claims and ClaimsInterface for better control on the encodi… #3

feat: Add Claims and ClaimsInterface for better control on the encodi…

feat: Add Claims and ClaimsInterface for better control on the encodi… #3

Triggered via push August 2, 2023 12:42
Status Success
Total duration 44s
Artifacts

php.yml

on: push
Matrix: build
Fit to window
Zoom out
Zoom in

Annotations

18 warnings
PHP 8.2
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, szenius/set-timezone@v1.0. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
PHP 8.1
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, szenius/set-timezone@v1.0. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
PHP 8.0
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, szenius/set-timezone@v1.0. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
PHP 7.4
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, szenius/set-timezone@v1.0. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
PHP 7.2
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, szenius/set-timezone@v1.0. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
PHP 7.3
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, szenius/set-timezone@v1.0. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
PHP 7.1
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, szenius/set-timezone@v1.0. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
Analysis
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, szenius/set-timezone@v1.0. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
Analysis: src/Claims.php#L74
Escaped Mutant: --- Original +++ New @@ @@ { // Disallow `$claims[] = xxx` operation if ($offset === null) { - throw new BadMethodCallException('Cannot use array push operator `$claims[] = $x` on ' . static::class); + throw new BadMethodCallException(static::class . 'Cannot use array push operator `$claims[] = $x` on '); } $this->claims[$offset] = $value; }
Analysis: src/Claims.php#L74
Escaped Mutant: --- Original +++ New @@ @@ { // Disallow `$claims[] = xxx` operation if ($offset === null) { - throw new BadMethodCallException('Cannot use array push operator `$claims[] = $x` on ' . static::class); + throw new BadMethodCallException(static::class); } $this->claims[$offset] = $value; }
Analysis: src/Claims.php#L74
Escaped Mutant: --- Original +++ New @@ @@ { // Disallow `$claims[] = xxx` operation if ($offset === null) { - throw new BadMethodCallException('Cannot use array push operator `$claims[] = $x` on ' . static::class); + throw new BadMethodCallException('Cannot use array push operator `$claims[] = $x` on '); } $this->claims[$offset] = $value; }
Analysis: src/JwtDecoder.php#L90
Escaped Mutant: --- Original +++ New @@ @@ */ public function decode(string $jwt, JWKSet $keySet) : JWT { - $loader = new JWSLoader($this->serializerManager, new JWSVerifier($this->jwa->manager()), new HeaderCheckerManager([new AlgorithmChecker($this->jwa->manager()->list())], [new JWSTokenSupport()])); + $loader = new JWSLoader($this->serializerManager, new JWSVerifier($this->jwa->manager()), new HeaderCheckerManager([], [new JWSTokenSupport()])); try { $decoded = $loader->loadAndVerifyWithKeySet($jwt, $keySet, $signatureOffset); } catch (Exception $e) {
Analysis: src/JwtDecoder.php#L96
Escaped Mutant: --- Original +++ New @@ @@ try { $decoded = $loader->loadAndVerifyWithKeySet($jwt, $keySet, $signatureOffset); } catch (Exception $e) { - throw new InvalidArgumentException('Invalid JWT or signature', 0, $e); + throw new InvalidArgumentException('Invalid JWT or signature', -1, $e); } /** @psalm-suppress PossiblyNullArrayOffset */ $signature = $decoded->getSignatures()[$signatureOffset];
Analysis: src/JwtDecoder.php#L96
Escaped Mutant: --- Original +++ New @@ @@ try { $decoded = $loader->loadAndVerifyWithKeySet($jwt, $keySet, $signatureOffset); } catch (Exception $e) { - throw new InvalidArgumentException('Invalid JWT or signature', 0, $e); + throw new InvalidArgumentException('Invalid JWT or signature', 1, $e); } /** @psalm-suppress PossiblyNullArrayOffset */ $signature = $decoded->getSignatures()[$signatureOffset];
Analysis: src/JwtDecoder.php#L102
Escaped Mutant: --- Original +++ New @@ @@ } /** @psalm-suppress PossiblyNullArrayOffset */ $signature = $decoded->getSignatures()[$signatureOffset]; - $payload = json_decode((string) $decoded->getPayload(), true); + $payload = json_decode($decoded->getPayload(), true); if (!is_array($payload)) { throw new InvalidArgumentException('Invalid JWT payload'); }
Analysis: src/JwtEncoder.php#L38
Escaped Mutant: --- Original +++ New @@ @@ */ public function __construct(?JWA $jwa = null, ?JWSSerializer $serializer = null) { - $this->jwa = $jwa ?? new JWA(); + $this->jwa = new JWA() ?? $jwa; $this->serializer = $serializer ?? new CompactSerializer(); } /**
Analysis: src/JwtEncoder.php#L39
Escaped Mutant: --- Original +++ New @@ @@ public function __construct(?JWA $jwa = null, ?JWSSerializer $serializer = null) { $this->jwa = $jwa ?? new JWA(); - $this->serializer = $serializer ?? new CompactSerializer(); + $this->serializer = new CompactSerializer() ?? $serializer; } /** * Get the supported algorithms
Analysis: src/JwtEncoder.php#L88
Escaped Mutant: --- Original +++ New @@ @@ public function encode($payload, JWKSet $keySet, string $algorithm = 'RS256', ?string $kid = null) : string { static $isLegacyJwsBuilder = null; - if ($isLegacyJwsBuilder === null) { + if ($isLegacyJwsBuilder !== null) { $ctor = (new \ReflectionClass(JWSBuilder::class))->getConstructor(); /** @psalm-suppress PossiblyNullReference */ $isLegacyJwsBuilder = $ctor->getNumberOfParameters() === 2;