Skip to content

Commit

Permalink
cs fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ziwot committed Nov 30, 2024
1 parent 3a4647e commit 0a9f298
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Keys/Curve.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public function sign(string $hash, string $privateKey): Signature;
public function verifySignature(
string $signature,
string $hash,
string $publicKey
string $publicKey,
): bool;
}
2 changes: 1 addition & 1 deletion src/Keys/Ed25519.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function sign(string $message, string $privKey): Signature
public function verifySignature(
string $signature,
string $message,
string $pubKey
string $pubKey,
): bool {
$signature = b58cdecode($signature, $this->signaturePrefix());
$message = blake2b(hex2bin($message));
Expand Down
4 changes: 2 additions & 2 deletions src/Keys/Secp256K1.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function sign(string $message, string $privKey): Signature
$key = $ec->keyFromPrivate($privKey, 'hex');
$signature = $key->sign(bin2hex($hash));

\assert($signature instanceof Ec\Signature);
\assert($signature instanceof EC\Signature);

$hex = bin2hex(
pack('C*', ...$signature->r->toArray()).
Expand All @@ -56,7 +56,7 @@ public function sign(string $message, string $privKey): Signature
public function verifySignature(
string $signature,
string $message,
string $pubKey
string $pubKey,
): bool {
$hash = bin2hex(sodium_crypto_generichash(hex2bin($message)));
$signature = b58cdecode($signature, $this->signaturePrefix());
Expand Down
2 changes: 1 addition & 1 deletion src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function validatePubKey(string $value): bool

private function validatePrefixedValue(string $value, array $prefixes): bool
{
$pattern = sprintf('/^(%s)/', implode('|', $prefixes));
$pattern = \sprintf('/^(%s)/', implode('|', $prefixes));

if (0 === preg_match($pattern, $value, $matches)) {
$this->error = static::NO_PREFIX_MATCHED;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/DataProvider/Models/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Account
public function __construct(
string $privateKey,
string $publicKey,
string $publicKeyHash
string $publicKeyHash,
) {
$this->privateKey = $privateKey;
$this->publicKey = $publicKey;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/DataProvider/Models/Signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function __construct(
Account $account,
string $message,
string $signature,
bool $valid = true
bool $valid = true,
) {
$this->account = $account;
$this->message = $message;
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/ValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function setUp(): void
public function testValidateAddress(
string $address,
bool $isValid,
string $error = null
?string $error = null,
): void {
self::assertSame($isValid, $this->validator->validateAddress($address));
self::assertSame($error, $this->validator->getError());
Expand All @@ -44,7 +44,7 @@ public static function provideAddresses(): \Generator
public function testValidatePubKey(
string $pubKey,
bool $isValid,
string $error = null
?string $error = null,
): void {
self::assertSame($isValid, $this->validator->validatePubKey($pubKey));
self::assertSame($error, $this->validator->getError());
Expand Down

0 comments on commit 0a9f298

Please sign in to comment.