Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To Rector 1.0 #516

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"phpstan/phpstan-strict-rules": "^1.4",
"phpunit/phpunit": "^10.1",
"qossmic/deptrac-shim": "^1.0",
"rector/rector": "^0.19",
"rector/rector": "^1.0",
"roave/security-advisories": "dev-latest",
"symfony/browser-kit": "^6.1|^7.0",
"symfony/finder": "^6.1|^7.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Library/KeyManagement/KeyConverter/KeyConverter.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check failure on line 1 in src/Library/KeyManagement/KeyConverter/KeyConverter.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static Analysis

Ignored error pattern #^Parameter \#3 \$subject of function preg_replace expects array\|string, string\|null given\.$# in path /home/runner/work/jwt-framework/jwt-framework/src/Library/KeyManagement/KeyConverter/KeyConverter.php was not matched in reported errors.

declare(strict_types=1);

Expand Down Expand Up @@ -86,7 +86,7 @@
$values = self::loadKeyFromPEM($details['key']);
openssl_x509_export($res, $out);
$x5c = preg_replace('#-.*-#', '', (string) $out);
$x5c = preg_replace('~\R~', '', $x5c);
$x5c = preg_replace('~\R~', '', (string) $x5c);
if (! is_string($x5c)) {
throw new InvalidArgumentException('Unable to load the certificate');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Component/Signature/JWSFlattenedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public function loadFlattenedJWS(): void
'iss' => 'joe',
'exp' => 1_300_819_380,
'http://example.com/is_root' => true,
], json_decode($loaded->getPayload(), true, 512, JSON_THROW_ON_ERROR));
], json_decode((string) $loaded->getPayload(), true, 512, JSON_THROW_ON_ERROR));
}
}
2 changes: 1 addition & 1 deletion tests/Component/Signature/RFC7520/NestingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ public function signatureVerification(): void

static::assertTrue($jwsVerifier->verifyWithKey($loaded_compact_json, $signature_key, 0));
static::assertSame($signature_header, $loaded_compact_json->getSignature(0)->getProtectedHeader());
static::assertSame($payload, json_decode($loaded_compact_json->getPayload(), true, 512, JSON_THROW_ON_ERROR));
static::assertSame($payload, json_decode((string) $loaded_compact_json->getPayload(), true, 512, JSON_THROW_ON_ERROR));
}
}
4 changes: 2 additions & 2 deletions tests/Component/Signature/SignerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ public function signAndLoadJWKSet(): void
static::assertSame(2, $loaded->countSignatures());
static::assertEqualsCanonicalizing(
$this->getKeyset(),
JWKSet::createFromKeyData(json_decode($loaded->getPayload(), true, 512, JSON_THROW_ON_ERROR))
JWKSet::createFromKeyData(json_decode((string) $loaded->getPayload(), true, 512, JSON_THROW_ON_ERROR))
);
static::assertTrue($jwsVerifier->verifyWithKeySet($loaded, $this->getSymmetricKeySet(), 0));
static::assertTrue($jwsVerifier->verifyWithKeySet($loaded, $this->getPublicKeySet(), 1));
Expand Down Expand Up @@ -1009,7 +1009,7 @@ public function keySetIsEmpty(): void
static::assertSame(2, $loaded->countSignatures());
static::assertEqualsCanonicalizing(
$this->getKeyset(),
JWKSet::createFromKeyData(json_decode($loaded->getPayload(), true, 512, JSON_THROW_ON_ERROR))
JWKSet::createFromKeyData(json_decode((string) $loaded->getPayload(), true, 512, JSON_THROW_ON_ERROR))
);
static::assertTrue($jwsVerifier->verifyWithKeySet($loaded, new JWKSet([]), 0));
static::assertTrue($jwsVerifier->verifyWithKey($loaded, new JWK([
Expand Down
8 changes: 4 additions & 4 deletions tests/SignatureAlgorithm/RSA/RSASignatureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public function loadJWSJSONSerialization(): void
'{"payload":"eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ","signatures":[{"protected":"eyJhbGciOiJSUzI1NiJ9","header":{"kid":"2010-12-29"},"signature":"cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZmh7AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5jujGbds9uJdbF9CUAr7t1dnZcAcQjbKBYNX4BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHlb1L07Qe7K0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZESc6BfI7noOPqvhJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AXLIhWkWywlVmtVrBp0igcN_IoypGlUPQGe77Rw"},{"protected":"eyJhbGciOiJFUzI1NiJ9","header":{"kid":"e9bc097a-ce51-4036-9562-d2ade882db0d"},"signature":"DtEhU3ljbEg8L38VWAfUAqOyKAM6-Xx-F4GawxaepmXFCgfTjDxw5djxLa8ISlSApmWQxfKTUJqPP3-Kg6NU1Q"}]}'
);

$claims = json_decode($result->getPayload(), true, 512, JSON_THROW_ON_ERROR);
$claims = json_decode((string) $result->getPayload(), true, 512, JSON_THROW_ON_ERROR);
static::assertSame([
'iss' => 'joe',
'exp' => 1_300_819_380,
Expand Down Expand Up @@ -440,7 +440,7 @@ public function loadIETFExample1(): void
'iss' => 'joe',
'exp' => 1_300_819_380,
'http://example.com/is_root' => true,
], json_decode($result->getPayload(), true, 512, JSON_THROW_ON_ERROR));
], json_decode((string) $result->getPayload(), true, 512, JSON_THROW_ON_ERROR));
static::assertSame(1, $result->countSignatures());
static::assertSame('HS256', $result->getSignature(0)->getProtectedHeaderParameter('alg'));
}
Expand All @@ -460,7 +460,7 @@ public function loadIETFExample2(): void
'iss' => 'joe',
'exp' => 1_300_819_380,
'http://example.com/is_root' => true,
], json_decode($result->getPayload(), true, 512, JSON_THROW_ON_ERROR));
], json_decode((string) $result->getPayload(), true, 512, JSON_THROW_ON_ERROR));
static::assertSame(1, $result->countSignatures());
static::assertSame('RS256', $result->getSignature(0)->getProtectedHeaderParameter('alg'));
}
Expand All @@ -480,7 +480,7 @@ public function loadIETFExample3(): void
'iss' => 'joe',
'exp' => 1_300_819_380,
'http://example.com/is_root' => true,
], json_decode($result->getPayload(), true, 512, JSON_THROW_ON_ERROR));
], json_decode((string) $result->getPayload(), true, 512, JSON_THROW_ON_ERROR));
static::assertSame(1, $result->countSignatures());
static::assertSame('ES256', $result->getSignature(0)->getProtectedHeaderParameter('alg'));
}
Expand Down
Loading