From 0a9f298106194f592094c59d1fb1fb5de7a5f990 Mon Sep 17 00:00:00 2001 From: steven j Date: Sat, 30 Nov 2024 12:26:53 +0100 Subject: [PATCH] cs fix --- src/Keys/Curve.php | 2 +- src/Keys/Ed25519.php | 2 +- src/Keys/Secp256K1.php | 4 ++-- src/Validator.php | 2 +- tests/Unit/DataProvider/Models/Account.php | 2 +- tests/Unit/DataProvider/Models/Signature.php | 2 +- tests/Unit/ValidatorTest.php | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Keys/Curve.php b/src/Keys/Curve.php index b9fd8b9..b03d34e 100644 --- a/src/Keys/Curve.php +++ b/src/Keys/Curve.php @@ -21,6 +21,6 @@ public function sign(string $hash, string $privateKey): Signature; public function verifySignature( string $signature, string $hash, - string $publicKey + string $publicKey, ): bool; } diff --git a/src/Keys/Ed25519.php b/src/Keys/Ed25519.php index c4f1c58..7a1f6f9 100644 --- a/src/Keys/Ed25519.php +++ b/src/Keys/Ed25519.php @@ -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)); diff --git a/src/Keys/Secp256K1.php b/src/Keys/Secp256K1.php index 19d2423..69c5dba 100644 --- a/src/Keys/Secp256K1.php +++ b/src/Keys/Secp256K1.php @@ -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()). @@ -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()); diff --git a/src/Validator.php b/src/Validator.php index 6543ec6..93a231c 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -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; diff --git a/tests/Unit/DataProvider/Models/Account.php b/tests/Unit/DataProvider/Models/Account.php index 514b777..311d177 100644 --- a/tests/Unit/DataProvider/Models/Account.php +++ b/tests/Unit/DataProvider/Models/Account.php @@ -13,7 +13,7 @@ class Account public function __construct( string $privateKey, string $publicKey, - string $publicKeyHash + string $publicKeyHash, ) { $this->privateKey = $privateKey; $this->publicKey = $publicKey; diff --git a/tests/Unit/DataProvider/Models/Signature.php b/tests/Unit/DataProvider/Models/Signature.php index 8739119..b8a940b 100644 --- a/tests/Unit/DataProvider/Models/Signature.php +++ b/tests/Unit/DataProvider/Models/Signature.php @@ -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; diff --git a/tests/Unit/ValidatorTest.php b/tests/Unit/ValidatorTest.php index 1e6f20c..c7280d1 100644 --- a/tests/Unit/ValidatorTest.php +++ b/tests/Unit/ValidatorTest.php @@ -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()); @@ -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());